@sphereon/ssi-sdk-ext.identifier-resolution 0.24.1-next.103 → 0.24.1-next.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent/IdentifierResolution.d.ts +3 -0
- package/dist/agent/IdentifierResolution.d.ts.map +1 -1
- package/dist/agent/IdentifierResolution.js +18 -0
- package/dist/agent/IdentifierResolution.js.map +1 -1
- package/dist/functions/LegacySupport.d.ts.map +1 -1
- package/dist/functions/LegacySupport.js +5 -4
- package/dist/functions/LegacySupport.js.map +1 -1
- package/dist/functions/externalIdentifierFunctions.d.ts +17 -1
- package/dist/functions/externalIdentifierFunctions.d.ts.map +1 -1
- package/dist/functions/externalIdentifierFunctions.js +82 -2
- package/dist/functions/externalIdentifierFunctions.js.map +1 -1
- package/dist/functions/managedIdentifierFunctions.d.ts +7 -1
- package/dist/functions/managedIdentifierFunctions.d.ts.map +1 -1
- package/dist/functions/managedIdentifierFunctions.js +39 -1
- package/dist/functions/managedIdentifierFunctions.js.map +1 -1
- package/dist/types/IIdentifierResolution.d.ts +5 -2
- package/dist/types/IIdentifierResolution.d.ts.map +1 -1
- package/dist/types/IIdentifierResolution.js +3 -0
- package/dist/types/IIdentifierResolution.js.map +1 -1
- package/dist/types/common.d.ts +2 -1
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +5 -1
- package/dist/types/common.js.map +1 -1
- package/dist/types/externalIdentifierTypes.d.ts +23 -6
- package/dist/types/externalIdentifierTypes.d.ts.map +1 -1
- package/dist/types/externalIdentifierTypes.js +6 -1
- package/dist/types/externalIdentifierTypes.js.map +1 -1
- package/dist/types/managedIdentifierTypes.d.ts +16 -6
- package/dist/types/managedIdentifierTypes.d.ts.map +1 -1
- package/dist/types/managedIdentifierTypes.js +10 -1
- package/dist/types/managedIdentifierTypes.js.map +1 -1
- package/package.json +12 -12
- package/plugin.schema.json +932 -110
- package/src/agent/IdentifierResolution.ts +33 -1
- package/src/functions/LegacySupport.ts +45 -41
- package/src/functions/externalIdentifierFunctions.ts +94 -4
- package/src/functions/managedIdentifierFunctions.ts +46 -2
- package/src/types/IIdentifierResolution.ts +18 -0
- package/src/types/common.ts +5 -1
- package/src/types/externalIdentifierTypes.ts +54 -13
- package/src/types/managedIdentifierTypes.ts +37 -8
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { JWK } from '@sphereon/ssi-
|
|
1
|
+
import { ICoseKeyJson, JWK } from '@sphereon/ssi-types'
|
|
2
2
|
import { DIDDocumentSection, IIdentifier, IKey, TKeyType } from '@veramo/core'
|
|
3
|
-
import { isDidIdentifier, isJwkIdentifier, isKeyIdentifier, isKidIdentifier, isX5cIdentifier, JwkInfo } from './common'
|
|
3
|
+
import { isCoseKeyIdentifier, isDidIdentifier, isJwkIdentifier, isKeyIdentifier, isKidIdentifier, isX5cIdentifier, JwkInfo } from './common'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Use whenever we need to pass in an identifier. We can pass in kids, DIDs, IIdentifier objects and x5chains
|
|
7
7
|
*
|
|
8
8
|
* The functions below can be used to check the type, and they also provide the proper 'runtime' types
|
|
9
9
|
*/
|
|
10
|
-
export type ManagedIdentifierType = IIdentifier /*did*/ | string /*did or kid*/ | string[] /*x5c*/ | JWK | IKey
|
|
10
|
+
export type ManagedIdentifierType = IIdentifier /*did*/ | string /*did or kid*/ | string[] /*x5c*/ | JWK | IKey | ICoseKeyJson
|
|
11
11
|
|
|
12
12
|
export type ManagedIdentifierOpts = (
|
|
13
13
|
| ManagedIdentifierJwkOpts
|
|
@@ -15,6 +15,7 @@ export type ManagedIdentifierOpts = (
|
|
|
15
15
|
| ManagedIdentifierDidOpts
|
|
16
16
|
| ManagedIdentifierKidOpts
|
|
17
17
|
| ManagedIdentifierKeyOpts
|
|
18
|
+
| ManagedIdentifierCoseKeyOpts
|
|
18
19
|
) &
|
|
19
20
|
ManagedIdentifierOptsBase
|
|
20
21
|
|
|
@@ -56,11 +57,21 @@ export type ManagedIdentifierKeyOpts = Omit<ManagedIdentifierOptsBase, 'method'>
|
|
|
56
57
|
identifier: IKey
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
export function isManagedIdentifierKeyOpts(opts: ManagedIdentifierOptsBase): opts is
|
|
60
|
+
export function isManagedIdentifierKeyOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierKeyOpts {
|
|
60
61
|
const { identifier } = opts
|
|
61
62
|
return ('method' in opts && opts.method === 'key') || isKeyIdentifier(identifier)
|
|
62
63
|
}
|
|
63
64
|
|
|
65
|
+
export type ManagedIdentifierCoseKeyOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
|
|
66
|
+
method?: 'cose_key'
|
|
67
|
+
identifier: ICoseKeyJson
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function isManagedIdentifierCoseKeyOpts(opts: ManagedIdentifierOptsBase): opts is ManagedIdentifierCoseKeyOpts {
|
|
71
|
+
const { identifier } = opts
|
|
72
|
+
return ('method' in opts && opts.method === 'cose_key') || isCoseKeyIdentifier(identifier)
|
|
73
|
+
}
|
|
74
|
+
|
|
64
75
|
export type ManagedIdentifierJwkOpts = Omit<ManagedIdentifierOptsBase, 'method'> & {
|
|
65
76
|
method?: 'jwk'
|
|
66
77
|
identifier: JWK
|
|
@@ -114,6 +125,10 @@ export function isManagedIdentifierKeyResult(object: IManagedIdentifierResultBas
|
|
|
114
125
|
return object!! && typeof object === 'object' && 'method' in object && object.method === 'key'
|
|
115
126
|
}
|
|
116
127
|
|
|
128
|
+
export function isManagedIdentifierCoseKeyResult(object: IManagedIdentifierResultBase): object is ManagedIdentifierCoseKeyResult {
|
|
129
|
+
return object!! && typeof object === 'object' && 'method' in object && object.method === 'cose_key'
|
|
130
|
+
}
|
|
131
|
+
|
|
117
132
|
export interface ManagedIdentifierDidResult extends IManagedIdentifierResultBase {
|
|
118
133
|
method: 'did'
|
|
119
134
|
identifier: IIdentifier
|
|
@@ -142,6 +157,11 @@ export interface ManagedIdentifierKeyResult extends IManagedIdentifierResultBase
|
|
|
142
157
|
identifier: IKey
|
|
143
158
|
}
|
|
144
159
|
|
|
160
|
+
export interface ManagedIdentifierCoseKeyResult extends IManagedIdentifierResultBase {
|
|
161
|
+
method: 'cose_key'
|
|
162
|
+
identifier: ICoseKeyJson
|
|
163
|
+
}
|
|
164
|
+
|
|
145
165
|
export interface ManagedIdentifierX5cResult extends IManagedIdentifierResultBase {
|
|
146
166
|
method: 'x5c'
|
|
147
167
|
identifier: string[]
|
|
@@ -149,9 +169,18 @@ export interface ManagedIdentifierX5cResult extends IManagedIdentifierResultBase
|
|
|
149
169
|
certificate: any // Certificate(JSON_, but trips schema generator. Probably want to create our own DTO
|
|
150
170
|
}
|
|
151
171
|
|
|
152
|
-
export type ManagedIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid' | 'key'
|
|
172
|
+
export type ManagedIdentifierMethod = 'did' | 'jwk' | 'x5c' | 'kid' | 'key' | 'cose_key'
|
|
153
173
|
|
|
154
174
|
export type ManagedIdentifierResult = IManagedIdentifierResultBase &
|
|
155
|
-
(
|
|
156
|
-
|
|
157
|
-
|
|
175
|
+
(
|
|
176
|
+
| ManagedIdentifierX5cResult
|
|
177
|
+
| ManagedIdentifierDidResult
|
|
178
|
+
| ManagedIdentifierJwkResult
|
|
179
|
+
| ManagedIdentifierKidResult
|
|
180
|
+
| ManagedIdentifierKeyResult
|
|
181
|
+
| ManagedIdentifierCoseKeyResult
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
export type ManagedIdentifierOptsOrResult = (ManagedIdentifierResult | ManagedIdentifierOpts) & {
|
|
185
|
+
lazyDisabled?: boolean
|
|
186
|
+
}
|