@sphereon/ssi-sdk-ext.identifier-resolution 0.24.1-unstable.93 → 0.25.0

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 (48) hide show
  1. package/dist/agent/IdentifierResolution.d.ts +4 -0
  2. package/dist/agent/IdentifierResolution.d.ts.map +1 -1
  3. package/dist/agent/IdentifierResolution.js +25 -1
  4. package/dist/agent/IdentifierResolution.js.map +1 -1
  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 +17 -1
  10. package/dist/functions/externalIdentifierFunctions.d.ts.map +1 -1
  11. package/dist/functions/externalIdentifierFunctions.js +85 -6
  12. package/dist/functions/externalIdentifierFunctions.js.map +1 -1
  13. package/dist/functions/index.d.ts +1 -11
  14. package/dist/functions/index.d.ts.map +1 -1
  15. package/dist/functions/index.js +1 -36
  16. package/dist/functions/index.js.map +1 -1
  17. package/dist/functions/managedIdentifierFunctions.d.ts +17 -3
  18. package/dist/functions/managedIdentifierFunctions.d.ts.map +1 -1
  19. package/dist/functions/managedIdentifierFunctions.js +134 -12
  20. package/dist/functions/managedIdentifierFunctions.js.map +1 -1
  21. package/dist/tsdoc-metadata.json +1 -1
  22. package/dist/types/IIdentifierResolution.d.ts +12 -3
  23. package/dist/types/IIdentifierResolution.d.ts.map +1 -1
  24. package/dist/types/IIdentifierResolution.js +17 -0
  25. package/dist/types/IIdentifierResolution.js.map +1 -1
  26. package/dist/types/common.d.ts +3 -1
  27. package/dist/types/common.d.ts.map +1 -1
  28. package/dist/types/common.js +17 -10
  29. package/dist/types/common.js.map +1 -1
  30. package/dist/types/externalIdentifierTypes.d.ts +23 -6
  31. package/dist/types/externalIdentifierTypes.d.ts.map +1 -1
  32. package/dist/types/externalIdentifierTypes.js +11 -7
  33. package/dist/types/externalIdentifierTypes.js.map +1 -1
  34. package/dist/types/managedIdentifierTypes.d.ts +43 -15
  35. package/dist/types/managedIdentifierTypes.d.ts.map +1 -1
  36. package/dist/types/managedIdentifierTypes.js +24 -11
  37. package/dist/types/managedIdentifierTypes.js.map +1 -1
  38. package/package.json +12 -12
  39. package/plugin.schema.json +2555 -313
  40. package/src/agent/IdentifierResolution.ts +63 -10
  41. package/src/functions/LegacySupport.ts +54 -0
  42. package/src/functions/externalIdentifierFunctions.ts +95 -5
  43. package/src/functions/index.ts +1 -51
  44. package/src/functions/managedIdentifierFunctions.ts +162 -14
  45. package/src/types/IIdentifierResolution.ts +42 -2
  46. package/src/types/common.ts +10 -2
  47. package/src/types/externalIdentifierTypes.ts +54 -13
  48. package/src/types/managedIdentifierTypes.ts +78 -16
@@ -1,13 +1,23 @@
1
- import { JWK } from '@sphereon/ssi-sdk-ext.key-utils'
1
+ import { ClientIdScheme } from '@sphereon/ssi-sdk-ext.x509-utils'
2
+ import { ICoseKeyJson, JWK } from '@sphereon/ssi-types'
2
3
  import { DIDDocumentSection, IIdentifier, IKey, TKeyType } from '@veramo/core'
3
- import { isDidIdentifier, isJwkIdentifier, isKeyIdentifier, isKidIdentifier, isX5cIdentifier, JwkInfo } from './common'
4
+ import {
5
+ isCoseKeyIdentifier,
6
+ isDidIdentifier,
7
+ isOID4VCIssuerIdentifier,
8
+ isJwkIdentifier,
9
+ isKeyIdentifier,
10
+ isKidIdentifier,
11
+ isX5cIdentifier,
12
+ JwkInfo
13
+ } from './common'
4
14
 
5
15
  /**
6
16
  * Use whenever we need to pass in an identifier. We can pass in kids, DIDs, IIdentifier objects and x5chains
7
17
  *
8
18
  * The functions below can be used to check the type, and they also provide the proper 'runtime' types
9
19
  */
10
- export type ManagedIdentifierType = IIdentifier /*did*/ | string /*did or kid*/ | string[] /*x5c*/ | JWK | IKey
20
+ export type ManagedIdentifierType = IIdentifier /*did*/ | string /*did or kid*/ | string[] /*x5c*/ | JWK | IKey | ICoseKeyJson
11
21
 
12
22
  export type ManagedIdentifierOpts = (
13
23
  | ManagedIdentifierJwkOpts
@@ -15,6 +25,8 @@ export type ManagedIdentifierOpts = (
15
25
  | ManagedIdentifierDidOpts
16
26
  | ManagedIdentifierKidOpts
17
27
  | ManagedIdentifierKeyOpts
28
+ | ManagedIdentifierCoseKeyOpts
29
+ | ManagedIdentifierOID4VCIssuerOpts
18
30
  ) &
19
31
  ManagedIdentifierOptsBase
20
32
 
@@ -24,9 +36,11 @@ export type ManagedIdentifierOptsBase = {
24
36
  kmsKeyRef?: string // The key reference for the KMS system. If provided this value will be used to determine the appropriate key. Otherwise it will be inferred
25
37
  issuer?: string // can be used when a specific issuer needs to end up, for instance when signing JWTs. Will be returned or inferred if not provided
26
38
  kid?: string // can be used when a specific kid value needs to be used. For instance when signing JWTs. Will be returned or inferred if not provided
39
+ clientId?: string
40
+ clientIdScheme?: ClientIdScheme | 'did' | string
27
41
  }
28
42
 
29
- export type ManagedIdentifierDidOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
43
+ export type ManagedIdentifierDidOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
30
44
  method?: 'did'
31
45
  identifier: IIdentifier | string
32
46
  keyType?: TKeyType
@@ -41,7 +55,7 @@ export function isManagedIdentifierDidOpts(opts: ManagedIdentifierOptsBase): opt
41
55
  return ('method' in opts && opts.method === 'did') || isDidIdentifier(identifier)
42
56
  }
43
57
 
44
- export type ManagedIdentifierKidOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
58
+ export type ManagedIdentifierKidOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
45
59
  method?: 'kid'
46
60
  identifier: string
47
61
  }
@@ -51,17 +65,37 @@ export function isManagedIdentifierKidOpts(opts: ManagedIdentifierOptsBase): opt
51
65
  return ('method' in opts && opts.method === 'kid') || isKidIdentifier(identifier)
52
66
  }
53
67
 
54
- export type ManagedIdentifierKeyOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
68
+ export type ManagedIdentifierKeyOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
55
69
  method?: 'key'
56
70
  identifier: IKey
57
71
  }
58
72
 
59
- export function isManagedIdentifierKeyOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierKidOpts {
73
+ export function isManagedIdentifierKeyOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierKeyOpts {
60
74
  const { identifier } = opts
61
75
  return ('method' in opts && opts.method === 'key') || isKeyIdentifier(identifier)
62
76
  }
63
77
 
64
- export type ManagedIdentifierJwkOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
78
+ export type ManagedIdentifierCoseKeyOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
79
+ method?: 'cose_key'
80
+ identifier: ICoseKeyJson
81
+ }
82
+
83
+ export function isManagedIdentifierCoseKeyOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierCoseKeyOpts {
84
+ const { identifier } = opts
85
+ return ('method' in opts && opts.method === 'cose_key') || isCoseKeyIdentifier(identifier)
86
+ }
87
+
88
+ export type ManagedIdentifierOID4VCIssuerOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
89
+ method?: 'oid4vci-issuer'
90
+ identifier: string
91
+ }
92
+
93
+ export function isManagedIdentifierOID4VCIssuerOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierCoseKeyOpts {
94
+ const { identifier } = opts
95
+ return ('method' in opts && opts.method === 'oid4vci-issuer') || isOID4VCIssuerIdentifier(identifier)
96
+ }
97
+
98
+ export type ManagedIdentifierJwkOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
65
99
  method?: 'jwk'
66
100
  identifier: JWK
67
101
  }
@@ -71,7 +105,7 @@ export function isManagedIdentifierJwkOpts(opts: ManagedIdentifierOptsBase): opt
71
105
  return ('method' in opts && opts.method === 'jwk') || isJwkIdentifier(identifier)
72
106
  }
73
107
 
74
- export type ManagedIdentifierX5cOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
108
+ export type ManagedIdentifierX5cOpts = Omit<ManagedIdentifierOptsBase, 'method' | 'identifier'> & {
75
109
  method?: 'x5c'
76
110
  identifier: string[]
77
111
  }
@@ -91,6 +125,13 @@ export interface IManagedIdentifierResultBase extends ManagedJwkInfo {
91
125
  key: IKey
92
126
  kid?: string
93
127
  issuer?: string
128
+ clientId?: string
129
+ clientIdScheme?: ClientIdScheme | 'did' | string
130
+ identifier: ManagedIdentifierType
131
+ }
132
+
133
+ export function isManagedIdentifierCoseKeyResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierCoseKeyResult {
134
+ return object!! && typeof object === 'object' && 'method' in object && object.method === 'cose_key'
94
135
  }
95
136
 
96
137
  export function isManagedIdentifierDidResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierDidResult {
@@ -126,30 +167,51 @@ export interface ManagedIdentifierDidResult extends IManagedIdentifierResultBase
126
167
  }
127
168
 
128
169
  export interface ManagedIdentifierJwkResult extends IManagedIdentifierResultBase {
170
+ identifier: JWK
129
171
  method: 'jwk'
130
172
  }
131
173
 
132
174
  export interface ManagedIdentifierKidResult extends IManagedIdentifierResultBase {
133
175
  method: 'kid'
134
- issuer: string
176
+ identifier: string
135
177
  kid: string
136
178
  }
137
179
 
138
180
  export interface ManagedIdentifierKeyResult extends IManagedIdentifierResultBase {
139
181
  method: 'key'
140
- issuer: string
141
- kid: string
182
+ identifier: IKey
183
+ }
184
+
185
+ export interface ManagedIdentifierCoseKeyResult extends IManagedIdentifierResultBase {
186
+ method: 'cose_key'
187
+ identifier: ICoseKeyJson
188
+ }
189
+
190
+ export interface ManagedIdentifierOID4VCIssuerResult extends IManagedIdentifierResultBase {
191
+ method: 'oid4vci-issuer'
192
+ identifier: string
142
193
  }
143
194
 
144
195
  export interface ManagedIdentifierX5cResult extends IManagedIdentifierResultBase {
145
196
  method: 'x5c'
197
+ identifier: string[]
146
198
  x5c: string[]
147
199
  certificate: any // Certificate(JSON_, but trips schema generator. Probably want to create our own DTO
148
200
  }
149
201
 
150
- export type ManagedIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid' | 'key'
202
+ export type ManagedIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid' | 'key' | 'cose_key' | 'oid4vci-issuer'
151
203
 
152
204
  export type ManagedIdentifierResult = IManagedIdentifierResultBase &
153
- (ManagedIdentifierX5cResult | ManagedIdentifierDidResult | ManagedIdentifierJwkResult | ManagedIdentifierKidResult | ManagedIdentifierKeyResult)
154
-
155
- export type ManagedIdentifierOptsOrResult = ManagedIdentifierResult | ManagedIdentifierOpts
205
+ (
206
+ | ManagedIdentifierX5cResult
207
+ | ManagedIdentifierDidResult
208
+ | ManagedIdentifierJwkResult
209
+ | ManagedIdentifierKidResult
210
+ | ManagedIdentifierKeyResult
211
+ | ManagedIdentifierCoseKeyResult
212
+ | ManagedIdentifierOID4VCIssuerResult
213
+ )
214
+
215
+ export type ManagedIdentifierOptsOrResult = (ManagedIdentifierResult | ManagedIdentifierOpts) & {
216
+ lazyDisabled?: boolean
217
+ }