@sphereon/ssi-sdk-ext.identifier-resolution 0.28.1-feature.jose.vcdm.52 → 0.28.1-feature.oyd.cmsm.improv.20

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.
Files changed (64) hide show
  1. package/dist/agent/IdentifierResolution.d.ts +38 -0
  2. package/dist/agent/IdentifierResolution.d.ts.map +1 -0
  3. package/dist/agent/IdentifierResolution.js +123 -0
  4. package/dist/agent/IdentifierResolution.js.map +1 -0
  5. package/dist/functions/LegacySupport.d.ts +12 -0
  6. package/dist/functions/LegacySupport.d.ts.map +1 -0
  7. package/dist/functions/LegacySupport.js +39 -0
  8. package/dist/functions/LegacySupport.js.map +1 -0
  9. package/dist/functions/externalIdentifierFunctions.d.ts +26 -0
  10. package/dist/functions/externalIdentifierFunctions.d.ts.map +1 -0
  11. package/dist/functions/externalIdentifierFunctions.js +250 -0
  12. package/dist/functions/externalIdentifierFunctions.js.map +1 -0
  13. package/dist/functions/externalOIDFIdentifier.d.ts +19 -0
  14. package/dist/functions/externalOIDFIdentifier.d.ts.map +1 -0
  15. package/dist/functions/externalOIDFIdentifier.js +106 -0
  16. package/dist/functions/externalOIDFIdentifier.js.map +1 -0
  17. package/dist/functions/index.d.ts +5 -0
  18. package/dist/functions/index.d.ts.map +1 -0
  19. package/dist/functions/index.js +21 -0
  20. package/dist/functions/index.js.map +1 -0
  21. package/dist/functions/managedIdentifierFunctions.d.ts +38 -0
  22. package/dist/functions/managedIdentifierFunctions.d.ts.map +1 -0
  23. package/dist/functions/managedIdentifierFunctions.js +359 -0
  24. package/dist/functions/managedIdentifierFunctions.js.map +1 -0
  25. package/dist/index.d.ts +7 -434
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +27 -12047
  28. package/dist/index.js.map +1 -1
  29. package/dist/types/IIdentifierResolution.d.ts +42 -0
  30. package/dist/types/IIdentifierResolution.d.ts.map +1 -0
  31. package/dist/types/IIdentifierResolution.js +21 -0
  32. package/dist/types/IIdentifierResolution.js.map +1 -0
  33. package/dist/types/common.d.ts +20 -0
  34. package/dist/types/common.d.ts.map +1 -0
  35. package/dist/types/common.js +51 -0
  36. package/dist/types/common.js.map +1 -0
  37. package/dist/types/externalIdentifierTypes.d.ts +114 -0
  38. package/dist/types/externalIdentifierTypes.d.ts.map +1 -0
  39. package/dist/types/externalIdentifierTypes.js +44 -0
  40. package/dist/types/externalIdentifierTypes.js.map +1 -0
  41. package/dist/types/index.d.ts +5 -0
  42. package/dist/types/index.d.ts.map +1 -0
  43. package/dist/types/index.js +21 -0
  44. package/dist/types/index.js.map +1 -0
  45. package/dist/types/managedIdentifierTypes.d.ts +122 -0
  46. package/dist/types/managedIdentifierTypes.d.ts.map +1 -0
  47. package/dist/types/managedIdentifierTypes.js +63 -0
  48. package/dist/types/managedIdentifierTypes.js.map +1 -0
  49. package/package.json +21 -34
  50. package/plugin.schema.json +1368 -8006
  51. package/src/agent/IdentifierResolution.ts +39 -40
  52. package/src/functions/LegacySupport.ts +2 -2
  53. package/src/functions/externalIdentifierFunctions.ts +18 -27
  54. package/src/functions/externalOIDFIdentifier.ts +7 -9
  55. package/src/functions/managedIdentifierFunctions.ts +19 -25
  56. package/src/index.ts +1 -1
  57. package/src/types/IIdentifierResolution.ts +4 -4
  58. package/src/types/IJwtService.d.ts +5 -6
  59. package/src/types/common.ts +4 -4
  60. package/src/types/externalIdentifierTypes.ts +7 -7
  61. package/src/types/managedIdentifierTypes.ts +4 -4
  62. package/dist/index.cjs +0 -12080
  63. package/dist/index.cjs.map +0 -1
  64. package/dist/index.d.cts +0 -439
package/dist/index.d.ts CHANGED
@@ -1,439 +1,12 @@
1
- import { JWK, ICoseKeyJson, IParsedDID } from '@sphereon/ssi-types';
2
- import { DIDDocumentSection, DIDDocument, DIDResolutionResult, IIdentifier, IKey, TKeyType, IPluginMethodMap, IAgentContext, IKeyManager, IDIDManager, IAgentPlugin, IResolver } from '@veramo/core';
3
- import { DidDocumentJwks } from '@sphereon/ssi-sdk-ext.did-utils';
4
- import { X509CertificateChainValidationOpts, X509ValidationResult, ClientIdScheme } from '@sphereon/ssi-sdk-ext.x509-utils';
5
- import { webcrypto } from 'node:crypto';
6
- import { IOIDFClient } from '@sphereon/ssi-sdk.oidf-client';
7
-
8
- // Copy of jwt-service typings since we cannot include that as devDependency due to cyclic dep
9
- /*
10
- import {
11
- ExternalIdentifierDidOpts,
12
- ExternalIdentifierResult,
13
- ExternalIdentifierX5cOpts,
14
- IIdentifierResolution,
15
- ManagedIdentifierOptsOrResult,
16
- ManagedIdentifierResult,
17
- } from '../types'*/
18
-
19
- interface BaseJwtPayload {
20
- iss?: string
21
- sub?: string
22
- aud?: string[] | string
23
- exp?: number
24
- nbf?: number
25
- iat?: number
26
- jti?: string
27
- }
28
- interface JwsPayload extends BaseJwtPayload {
29
- [key: string]: unknown
30
- }
31
-
32
1
  /**
33
- * Use whenever we need to resolve an external identifier. We can pass in kids, DIDs, and x5chains
34
- *
35
- * The functions below can be used to check the type, and they also provide the proper runtime types
36
- */
37
- type ExternalIdentifierType = string | string[] | JWK;
38
- type ExternalIdentifierOptsBase = {
39
- method?: ExternalIdentifierMethod;
40
- identifier: ExternalIdentifierType;
41
- };
42
- type ExternalIdentifierDidOpts = Omit<ExternalIdentifierOptsBase, 'method'> & {
43
- method?: 'did';
44
- identifier: string;
45
- noVerificationMethodFallback?: boolean;
46
- vmRelationship?: DIDDocumentSection;
47
- localResolution?: boolean;
48
- uniresolverResolution?: boolean;
49
- resolverResolution?: boolean;
50
- };
51
- declare function isExternalIdentifierDidOpts(opts: ExternalIdentifierOptsBase): opts is ExternalIdentifierDidOpts;
52
- type ExternalIdentifierOpts = (ExternalIdentifierJwkOpts | ExternalIdentifierX5cOpts | ExternalIdentifierDidOpts | ExternalIdentifierKidOpts | ExternalIdentifierCoseKeyOpts | ExternalIdentifierOIDFEntityIdOpts) & ExternalIdentifierOptsBase;
53
- type ExternalIdentifierKidOpts = Omit<ExternalIdentifierOptsBase, 'method'> & {
54
- method?: 'kid';
55
- identifier: string;
56
- };
57
- declare function isExternalIdentifierKidOpts(opts: ExternalIdentifierOptsBase): opts is ExternalIdentifierKidOpts;
58
- type ExternalIdentifierJwkOpts = Omit<ExternalIdentifierOptsBase, 'method'> & {
59
- method?: 'jwk';
60
- identifier: JWK;
61
- x5c?: ExternalIdentifierX5cOpts;
62
- };
63
- declare function isExternalIdentifierJwkOpts(opts: ExternalIdentifierOptsBase): opts is ExternalIdentifierJwkOpts;
64
- type ExternalIdentifierCoseKeyOpts = Omit<ExternalIdentifierOptsBase, 'method'> & {
65
- method?: 'cose_key';
66
- identifier: ICoseKeyJson;
67
- };
68
- declare function isExternalIdentifierCoseKeyOpts(opts: ExternalIdentifierOptsBase): opts is ExternalIdentifierCoseKeyOpts;
69
- type ExternalIdentifierOidcDiscoveryOpts = Omit<ExternalIdentifierOptsBase, 'method'> & {
70
- method?: 'oidc-discovery';
71
- identifier: string;
72
- };
73
- declare function isExternalIdentifierOidcDiscoveryOpts(opts: ExternalIdentifierOptsBase): opts is ExternalIdentifierJwkOpts;
74
- type ExternalIdentifierJwksUrlOpts = Omit<ExternalIdentifierOptsBase, 'method'> & {
75
- method?: 'jwks-url';
76
- identifier: string;
77
- };
78
- declare function isExternalIdentifierJwksUrlOpts(opts: ExternalIdentifierOptsBase): opts is ExternalIdentifierJwksUrlOpts;
79
- type ExternalIdentifierOIDFEntityIdOpts = Omit<ExternalIdentifierOptsBase, 'method'> & {
80
- method?: 'entity_id';
81
- identifier: string;
82
- trustAnchors?: Array<string>;
83
- };
84
- declare function isExternalIdentifierOIDFEntityIdOpts(opts: ExternalIdentifierOptsBase): opts is ExternalIdentifierOIDFEntityIdOpts;
85
- type ExternalIdentifierX5cOpts = Omit<ExternalIdentifierOptsBase, 'method'> & X509CertificateChainValidationOpts & {
86
- method?: 'x5c';
87
- identifier: string[];
88
- verify?: boolean;
89
- verificationTime?: Date;
90
- trustAnchors?: string[];
91
- };
92
- declare function isExternalIdentifierX5cOpts(opts: ExternalIdentifierOptsBase): opts is ExternalIdentifierX5cOpts;
93
- type ExternalIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid' | 'cose_key' | 'oidc-discovery' | 'jwks-url' | 'oid4vci-issuer' | 'entity_id';
94
- type ExternalIdentifierResult = IExternalIdentifierResultBase & (ExternalIdentifierDidResult | ExternalIdentifierX5cResult | ExternalIdentifierJwkResult | ExternalIdentifierOIDFEntityIdResult | ExternalIdentifierCoseKeyResult);
95
- interface IExternalIdentifierResultBase {
96
- method: ExternalIdentifierMethod;
97
- jwks: Array<ExternalJwkInfo>;
98
- }
99
- interface ExternalIdentifierJwkResult extends IExternalIdentifierResultBase {
100
- method: 'jwk';
101
- jwk: JWK;
102
- x5c?: ExternalIdentifierX5cResult;
103
- }
104
- interface ExternalIdentifierCoseKeyResult extends IExternalIdentifierResultBase {
105
- method: 'cose_key';
106
- coseKey: ICoseKeyJson;
107
- x5c?: ExternalIdentifierX5cResult;
108
- }
109
- interface ExternalIdentifierX5cResult extends IExternalIdentifierResultBase {
110
- method: 'x5c';
111
- x5c: string[];
112
- issuerJWK: JWK;
113
- verificationResult?: X509ValidationResult;
114
- certificates: any[];
115
- }
116
- type TrustedAnchor = string;
117
- type PublicKeyHex = string;
118
- type ErrorMessage = string;
119
- interface ExternalIdentifierOIDFEntityIdResult extends IExternalIdentifierResultBase {
120
- method: 'entity_id';
121
- trustedAnchors: Array<TrustedAnchor>;
122
- errorList?: Record<TrustedAnchor, ErrorMessage>;
123
- jwtPayload?: JwsPayload;
124
- trustEstablished: boolean;
125
- }
126
- interface ExternalJwkInfo extends JwkInfo {
127
- kid?: string;
128
- publicKeyHex: string;
129
- }
130
- interface ExternalIdentifierDidResult extends IExternalIdentifierResultBase {
131
- method: 'did';
132
- did: string;
133
- didDocument?: DIDDocument;
134
- didJwks?: DidDocumentJwks;
135
- didResolutionResult: Omit<DIDResolutionResult, 'didDocument'>;
136
- didParsed: IParsedDID;
137
- }
138
-
139
- /**
140
- * Use whenever we need to pass in an identifier. We can pass in kids, DIDs, IIdentifier objects and x5chains
141
- *
142
- * The functions below can be used to check the type, and they also provide the proper 'runtime' types
143
- */
144
- type ManagedIdentifierType = IIdentifier | string | string[] | JWK | IKey | ICoseKeyJson;
145
- type ManagedIdentifierOpts = (ManagedIdentifierJwkOpts | ManagedIdentifierX5cOpts | ManagedIdentifierDidOpts | ManagedIdentifierKidOpts | ManagedIdentifierKeyOpts | ManagedIdentifierCoseKeyOpts | ManagedIdentifierOID4VCIssuerOpts) & ManagedIdentifierOptsBase;
146
- type ManagedIdentifierOptsBase = {
147
- method?: ManagedIdentifierMethod;
148
- identifier: ManagedIdentifierType;
149
- kmsKeyRef?: string;
150
- issuer?: string;
151
- kid?: string;
152
- clientId?: string;
153
- clientIdScheme?: ClientIdScheme | 'did' | string;
154
- };
155
- type ManagedIdentifierDidOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
156
- method?: 'did';
157
- identifier: IIdentifier | string;
158
- keyType?: TKeyType;
159
- offlineWhenNoDIDRegistered?: boolean;
160
- noVerificationMethodFallback?: boolean;
161
- controllerKey?: boolean;
162
- vmRelationship?: DIDDocumentSection;
163
- };
164
- declare function isManagedIdentifierDidOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierDidOpts;
165
- type ManagedIdentifierKidOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
166
- method?: 'kid';
167
- identifier: string;
168
- };
169
- declare function isManagedIdentifierKidOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierKidOpts;
170
- type ManagedIdentifierKeyOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
171
- method?: 'key';
172
- identifier: IKey;
173
- };
174
- declare function isManagedIdentifierKeyOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierKeyOpts;
175
- type ManagedIdentifierCoseKeyOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
176
- method?: 'cose_key';
177
- identifier: ICoseKeyJson;
178
- };
179
- declare function isManagedIdentifierCoseKeyOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierCoseKeyOpts;
180
- type ManagedIdentifierOID4VCIssuerOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
181
- method?: 'oid4vci-issuer';
182
- identifier: string;
183
- };
184
- declare function isManagedIdentifierOID4VCIssuerOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierCoseKeyOpts;
185
- type ManagedIdentifierJwkOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
186
- method?: 'jwk';
187
- identifier: JWK;
188
- };
189
- declare function isManagedIdentifierJwkOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierJwkOpts;
190
- type ManagedIdentifierX5cOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
191
- method?: 'x5c';
192
- identifier: string[];
193
- };
194
- declare function isManagedIdentifierX5cOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierX5cOpts;
195
- interface ManagedJwkInfo extends JwkInfo {
196
- kmsKeyRef: string;
197
- }
198
- interface IManagedIdentifierResultBase extends ManagedJwkInfo {
199
- method: ManagedIdentifierMethod;
200
- opts: ManagedIdentifierOpts;
201
- key: IKey;
202
- kid?: string;
203
- issuer?: string;
204
- clientId?: string;
205
- clientIdScheme?: ClientIdScheme | 'did' | string;
206
- identifier: ManagedIdentifierType;
207
- }
208
- declare function isManagedIdentifierCoseKeyResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierCoseKeyResult;
209
- declare function isManagedIdentifierDidResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierDidResult;
210
- declare function isManagedIdentifierX5cResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierX5cResult;
211
- declare function isManagedIdentifierJwkResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierJwkResult;
212
- declare function isManagedIdentifierKidResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierKidResult;
213
- declare function isManagedIdentifierKeyResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierKeyResult;
214
- interface ManagedIdentifierDidResult extends IManagedIdentifierResultBase {
215
- method: 'did';
216
- identifier: IIdentifier;
217
- did: string;
218
- keys: Array<IKey>;
219
- verificationMethodSection?: DIDDocumentSection;
220
- controllerKeyId?: string;
221
- issuer: string;
222
- kid: string;
223
- }
224
- interface ManagedIdentifierJwkResult extends IManagedIdentifierResultBase {
225
- identifier: JWK;
226
- method: 'jwk';
227
- }
228
- interface ManagedIdentifierKidResult extends IManagedIdentifierResultBase {
229
- method: 'kid';
230
- identifier: string;
231
- kid: string;
232
- }
233
- interface ManagedIdentifierKeyResult extends IManagedIdentifierResultBase {
234
- method: 'key';
235
- identifier: IKey;
236
- }
237
- interface ManagedIdentifierCoseKeyResult extends IManagedIdentifierResultBase {
238
- method: 'cose_key';
239
- identifier: ICoseKeyJson;
240
- }
241
- interface ManagedIdentifierOID4VCIssuerResult extends IManagedIdentifierResultBase {
242
- method: 'oid4vci-issuer';
243
- identifier: string;
244
- }
245
- interface ManagedIdentifierX5cResult extends IManagedIdentifierResultBase {
246
- method: 'x5c';
247
- identifier: string[];
248
- x5c: string[];
249
- certificate: any;
250
- }
251
- type ManagedIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid' | 'key' | 'cose_key' | 'oid4vci-issuer';
252
- type ManagedIdentifierResult = IManagedIdentifierResultBase & (ManagedIdentifierX5cResult | ManagedIdentifierDidResult | ManagedIdentifierJwkResult | ManagedIdentifierKidResult | ManagedIdentifierKeyResult | ManagedIdentifierCoseKeyResult | ManagedIdentifierOID4VCIssuerResult);
253
- type ManagedIdentifierOptsOrResult = (ManagedIdentifierResult | ManagedIdentifierOpts) & {
254
- lazyDisabled?: boolean;
255
- };
256
-
257
- interface JwkInfo {
258
- jwk: JWK;
259
- jwkThumbprint: string;
260
- }
261
- declare function isDidIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is IIdentifier | string;
262
- declare function isIIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is IIdentifier;
263
- declare function isJwkIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is JWK;
264
- declare function isOidcDiscoveryIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string;
265
- declare function isJwksUrlIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string;
266
- declare function isKidIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string;
267
- declare function isOID4VCIssuerIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string;
268
- declare function isKeyIdentifier(identifier: ManagedIdentifierType): identifier is IKey;
269
- declare function isCoseKeyIdentifier(identifier: ManagedIdentifierType): identifier is ICoseKeyJson;
270
- declare function isOIDFEntityIdIdentifier(identifier: ManagedIdentifierType): identifier is string;
271
- declare function isX5cIdentifier(identifier: ManagedIdentifierType | ExternalIdentifierType): identifier is string[];
272
-
273
- declare const identifierResolutionContextMethods: Array<string>;
274
- /**
275
- * @public
2
+ * @internal
276
3
  */
277
- interface IIdentifierResolution extends IPluginMethodMap {
278
- /**
279
- * Main method for managed identifiers. We always go through this method (also the others) as we want to integrate a plugin for anomaly detection. Having a single method helps
280
- *
281
- * The end result of all these methods is a common baseline response that allows to use a key from the registered KMS systems. It also provides kid and iss(uer) values that can be used in a JWT/JWS for instance
282
- * Allows to get a managed identifier result in case identifier options are passed in, but returns the identifier directly in case results are passed in. This means resolution can have happened before, or happens in this method
283
- *
284
- * We use the opts or result type almost everywhere, as it allows for just in time resolution whenever this method is called and afterwards we have the result, so resolution doesn't have to hit the DB, or external endpoints.
285
- * Also use this method in the local agent, not using REST. If case the identifier needs to be resolved, you can always have the above methods using REST
286
- * @param args
287
- * @param context
288
- * @public
289
- */
290
- identifierManagedGet(args: ManagedIdentifierOptsOrResult, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierResult>;
291
- identifierManagedGetByDid(args: ManagedIdentifierDidOpts, context: IAgentContext<IKeyManager & IDIDManager>): Promise<ManagedIdentifierDidResult>;
292
- identifierManagedGetByKid(args: ManagedIdentifierKidOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKidResult>;
293
- identifierManagedGetByJwk(args: ManagedIdentifierJwkOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierJwkResult>;
294
- identifierManagedGetByX5c(args: ManagedIdentifierX5cOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierX5cResult>;
295
- identifierManagedGetByKey(args: ManagedIdentifierKeyOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKeyResult>;
296
- identifierManagedGetByCoseKey(args: ManagedIdentifierCoseKeyOpts, context: IAgentContext<IKeyManager & IIdentifierResolution>): Promise<ManagedIdentifierCoseKeyResult>;
297
- identifierManagedGetByOID4VCIssuer(args: ManagedIdentifierOID4VCIssuerOpts, context: IAgentContext<any>): Promise<ManagedIdentifierOID4VCIssuerResult>;
298
- /**
299
- * Main method for external identifiers. We always go through this method (also the others) as we want to integrate a plugin for anomaly detection. Having a single method helps
300
- * @param args
301
- * @param context
302
- * @public
303
- */
304
- identifierExternalResolve(args: ExternalIdentifierOpts, context: IAgentContext<any>): Promise<ExternalIdentifierResult>;
305
- identifierExternalResolveByDid(args: ExternalIdentifierDidOpts, context: IAgentContext<any>): Promise<ExternalIdentifierDidResult>;
306
- identifierExternalResolveByJwk(args: ExternalIdentifierJwkOpts, context: IAgentContext<any>): Promise<ExternalIdentifierJwkResult>;
307
- identifierExternalResolveByCoseKey(args: ExternalIdentifierCoseKeyOpts, context: IAgentContext<any>): Promise<ExternalIdentifierCoseKeyResult>;
308
- identifierExternalResolveByX5c(args: ExternalIdentifierX5cOpts, context: IAgentContext<any>): Promise<ExternalIdentifierX5cResult>;
309
- identifierExternalResolveByOIDFEntityId(args: ExternalIdentifierOIDFEntityIdOpts, context: IAgentContext<any>): Promise<ExternalIdentifierOIDFEntityIdResult>;
310
- }
311
-
4
+ declare const schema: any;
5
+ export { schema };
312
6
  /**
313
7
  * @public
314
8
  */
315
- declare class IdentifierResolution implements IAgentPlugin {
316
- readonly _crypto: webcrypto.Crypto;
317
- readonly schema: any;
318
- readonly methods: IIdentifierResolution;
319
- /**
320
- * TODO: Add a cache, as we are retrieving the same keys/info quite often
321
- */
322
- constructor(opts?: {
323
- crypto?: webcrypto.Crypto;
324
- });
325
- /**
326
- * Main method for managed identifiers. We always go through this method (also the other methods below) as we want to
327
- * integrate a plugin for anomaly detection. Having a single method helps
328
- * @param args
329
- * @param context
330
- */
331
- private identifierManagedGet;
332
- private identifierManagedGetByDid;
333
- private identifierManagedGetByKid;
334
- private identifierManagedGetByKey;
335
- private identifierManagedGetByCoseKey;
336
- private identifierManagedGetByOID4VCIssuer;
337
- private identifierManagedGetByJwk;
338
- private identifierManagedGetByX5c;
339
- private identifierExternalResolve;
340
- private identifierExternalResolveByDid;
341
- private identifierExternalResolveByX5c;
342
- private identifierExternalResolveByCoseKey;
343
- private identifierExternalResolveByJwk;
344
- private identifierExternalResolveByOIDFEntityId;
345
- }
346
-
347
- declare function getManagedKidIdentifier(opts: ManagedIdentifierKidOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierKidResult>;
348
- declare function isManagedIdentifierResult(identifier: ManagedIdentifierOptsOrResult & {
349
- crypto?: webcrypto.Crypto;
350
- }): identifier is ManagedIdentifierResult;
351
- /**
352
- * Allows to get a managed identifier result in case identifier options are passed in, but returns the identifier directly in case results are passed in. This means resolution can have happened before, or happens in this method
353
- * @param identifier
354
- * @param context
355
- */
356
- declare function ensureManagedIdentifierResult(identifier: ManagedIdentifierOptsOrResult & {
357
- crypto?: webcrypto.Crypto;
358
- }, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierResult>;
359
- /**
360
- * This function is just a convenience function to get a common result. The user already apparently had a key, so could have called the kid version as well
361
- * @param opts
362
- * @param _context
363
- */
364
- declare function getManagedKeyIdentifier(opts: ManagedIdentifierKeyOpts, _context?: IAgentContext<any>): Promise<ManagedIdentifierKeyResult>;
365
- /**
366
- * This function is just a convenience function to get a common result. The user already apparently had a key, so could have called the kid version as well
367
- * @param opts
368
- * @param context
369
- */
370
- declare function getManagedCoseKeyIdentifier(opts: ManagedIdentifierCoseKeyOpts, context: IAgentContext<any>): Promise<ManagedIdentifierCoseKeyResult>;
371
- declare function getManagedDidIdentifier(opts: ManagedIdentifierDidOpts, context: IAgentContext<any>): Promise<ManagedIdentifierDidResult>;
372
- declare function getManagedJwkIdentifier(opts: ManagedIdentifierJwkOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierJwkResult>;
373
- declare function getManagedX5cIdentifier(opts: ManagedIdentifierX5cOpts & {
374
- crypto?: webcrypto.Crypto;
375
- }, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierX5cResult>;
376
- declare function getManagedOID4VCIssuerIdentifier(opts: ManagedIdentifierOID4VCIssuerOpts, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierOID4VCIssuerResult>;
377
- declare function getManagedIdentifier(opts: ManagedIdentifierOptsOrResult & {
378
- crypto?: webcrypto.Crypto;
379
- }, context: IAgentContext<IKeyManager>): Promise<ManagedIdentifierResult>;
380
- declare function managedIdentifierToKeyResult(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IIdentifierResolution & IKeyManager>): Promise<ManagedIdentifierKeyResult>;
381
- declare function managedIdentifierToJwk(identifier: ManagedIdentifierOptsOrResult, context: IAgentContext<IIdentifierResolution & IKeyManager>): Promise<ManagedIdentifierJwkResult>;
382
-
383
- declare function resolveExternalIdentifier(opts: ExternalIdentifierOpts & {
384
- crypto?: webcrypto.Crypto;
385
- }, context: IAgentContext<any>): Promise<ExternalIdentifierResult>;
386
- declare function resolveExternalX5cIdentifier(opts: ExternalIdentifierX5cOpts & {
387
- crypto?: webcrypto.Crypto;
388
- }, context: IAgentContext<IResolver & IDIDManager>): Promise<ExternalIdentifierX5cResult>;
389
- /**
390
- * Resolves a JWK. Normally this is just returning the JWK, but in case the JWK contains a x5c the chain is validated
391
- * @param opts
392
- * @param context
393
- */
394
- declare function resolveExternalJwkIdentifier(opts: ExternalIdentifierJwkOpts & {
395
- x5c?: ExternalIdentifierX5cOpts;
396
- }, context: IAgentContext<any>): Promise<ExternalIdentifierJwkResult>;
397
- /**
398
- * Resolves a JWK. Normally this is just returning the JWK, but in case the JWK contains a x5c the chain is validated
399
- * @param opts
400
- * @param context
401
- */
402
- declare function resolveExternalCoseKeyIdentifier(opts: ExternalIdentifierCoseKeyOpts & {
403
- x5c?: ExternalIdentifierX5cOpts;
404
- }, context: IAgentContext<any>): Promise<ExternalIdentifierCoseKeyResult>;
405
- declare function resolveExternalDidIdentifier(opts: ExternalIdentifierDidOpts, context: IAgentContext<IResolver & IDIDManager>): Promise<ExternalIdentifierDidResult>;
406
-
407
- /**
408
- * Resolves an OIDF Entity ID against multiple trust anchors to establish trusted relationships
409
- *
410
- * @param opts Configuration options containing the identifier to resolve and trust anchors to validate against
411
- * @param context Agent context that must include the OIDF client plugin and JWT verification capabilities
412
- *
413
- * @returns Promise resolving to an ExternalIdentifierOIDFEntityIdResult containing:
414
- * - trustedAnchors: Record mapping trust anchors to their public key hexes
415
- * - errorList: Optional record of errors encountered per trust anchor
416
- * - jwks: Array of JWK information from the trust chain
417
- * - trustEstablished: Boolean indicating if any trust relationships were established
418
- *
419
- * @throws Error if trust anchors are missing or JWT verification plugin is not enabled
420
- */
421
- declare function resolveExternalOIDFEntityIdIdentifier(opts: ExternalIdentifierOIDFEntityIdOpts, context: IAgentContext<IOIDFClient>): Promise<ExternalIdentifierOIDFEntityIdResult>;
422
-
423
- /**
424
- * Converts legacy id opts key refs to the new ManagedIdentifierOpts
425
- * @param opts
426
- */
427
- declare function legacyKeyRefsToIdentifierOpts(opts: {
428
- idOpts?: ManagedIdentifierOptsOrResult;
429
- iss?: string;
430
- keyRef?: string;
431
- didOpts?: any;
432
- }): ManagedIdentifierOptsOrResult;
433
-
434
- /**
435
- * @internal
436
- */
437
- declare const schema: any;
438
-
439
- export { type ErrorMessage, type ExternalIdentifierCoseKeyOpts, type ExternalIdentifierCoseKeyResult, type ExternalIdentifierDidOpts, type ExternalIdentifierDidResult, type ExternalIdentifierJwkOpts, type ExternalIdentifierJwkResult, type ExternalIdentifierJwksUrlOpts, type ExternalIdentifierKidOpts, type ExternalIdentifierMethod, type ExternalIdentifierOIDFEntityIdOpts, type ExternalIdentifierOIDFEntityIdResult, type ExternalIdentifierOidcDiscoveryOpts, type ExternalIdentifierOpts, type ExternalIdentifierOptsBase, type ExternalIdentifierResult, type ExternalIdentifierType, type ExternalIdentifierX5cOpts, type ExternalIdentifierX5cResult, type ExternalJwkInfo, type IExternalIdentifierResultBase, type IIdentifierResolution, type IManagedIdentifierResultBase, IdentifierResolution, type JwkInfo, type ManagedIdentifierCoseKeyOpts, type ManagedIdentifierCoseKeyResult, type ManagedIdentifierDidOpts, type ManagedIdentifierDidResult, type ManagedIdentifierJwkOpts, type ManagedIdentifierJwkResult, type ManagedIdentifierKeyOpts, type ManagedIdentifierKeyResult, type ManagedIdentifierKidOpts, type ManagedIdentifierKidResult, type ManagedIdentifierMethod, type ManagedIdentifierOID4VCIssuerOpts, type ManagedIdentifierOID4VCIssuerResult, type ManagedIdentifierOpts, type ManagedIdentifierOptsBase, type ManagedIdentifierOptsOrResult, type ManagedIdentifierResult, type ManagedIdentifierType, type ManagedIdentifierX5cOpts, type ManagedIdentifierX5cResult, type ManagedJwkInfo, type PublicKeyHex, type TrustedAnchor, ensureManagedIdentifierResult, getManagedCoseKeyIdentifier, getManagedDidIdentifier, getManagedIdentifier, getManagedJwkIdentifier, getManagedKeyIdentifier, getManagedKidIdentifier, getManagedOID4VCIssuerIdentifier, getManagedX5cIdentifier, identifierResolutionContextMethods, isCoseKeyIdentifier, isDidIdentifier, isExternalIdentifierCoseKeyOpts, isExternalIdentifierDidOpts, isExternalIdentifierJwkOpts, isExternalIdentifierJwksUrlOpts, isExternalIdentifierKidOpts, isExternalIdentifierOIDFEntityIdOpts, isExternalIdentifierOidcDiscoveryOpts, isExternalIdentifierX5cOpts, isIIdentifier, isJwkIdentifier, isJwksUrlIdentifier, isKeyIdentifier, isKidIdentifier, isManagedIdentifierCoseKeyOpts, isManagedIdentifierCoseKeyResult, isManagedIdentifierDidOpts, isManagedIdentifierDidResult, isManagedIdentifierJwkOpts, isManagedIdentifierJwkResult, isManagedIdentifierKeyOpts, isManagedIdentifierKeyResult, isManagedIdentifierKidOpts, isManagedIdentifierKidResult, isManagedIdentifierOID4VCIssuerOpts, isManagedIdentifierResult, isManagedIdentifierX5cOpts, isManagedIdentifierX5cResult, isOID4VCIssuerIdentifier, isOIDFEntityIdIdentifier, isOidcDiscoveryIdentifier, isX5cIdentifier, legacyKeyRefsToIdentifierOpts, managedIdentifierToJwk, managedIdentifierToKeyResult, resolveExternalCoseKeyIdentifier, resolveExternalDidIdentifier, resolveExternalIdentifier, resolveExternalJwkIdentifier, resolveExternalOIDFEntityIdIdentifier, resolveExternalX5cIdentifier, schema };
9
+ export { IdentifierResolution } from './agent/IdentifierResolution';
10
+ export * from './functions';
11
+ export * from './types';
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,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA"}