@sphereon/ssi-sdk.siopv2-oid4vp-rp-auth 0.34.1-feature.SSISDK.47.42 → 0.34.1-feature.SSISDK.50.100
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/index.cjs +351 -333
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -739
- package/dist/index.d.ts +40 -739
- package/dist/index.js +344 -325
- package/dist/index.js.map +1 -1
- package/package.json +19 -19
- package/src/RPInstance.ts +4 -5
- package/src/agent/SIOPv2RP.ts +47 -35
- package/src/functions.ts +2 -2
- package/src/index.ts +1 -1
- package/src/types/ISIOPv2RP.ts +33 -42
package/dist/index.js
CHANGED
|
@@ -1,341 +1,350 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
3
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
4
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
5
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
6
|
+
};
|
|
3
7
|
|
|
4
8
|
// plugin.schema.json
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
var require_plugin_schema = __commonJS({
|
|
10
|
+
"plugin.schema.json"(exports, module) {
|
|
11
|
+
module.exports = {
|
|
12
|
+
IDidAuthSiopOpAuthenticator: {
|
|
13
|
+
components: {
|
|
14
|
+
schemas: {
|
|
15
|
+
IGetSiopSessionArgs: {
|
|
16
|
+
type: "object",
|
|
17
|
+
properties: {
|
|
18
|
+
sessionId: {
|
|
19
|
+
type: "string"
|
|
20
|
+
},
|
|
21
|
+
additionalProperties: false
|
|
22
|
+
},
|
|
23
|
+
required: ["sessionId"],
|
|
24
|
+
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } "
|
|
14
25
|
},
|
|
15
|
-
|
|
16
|
-
},
|
|
17
|
-
required: ["sessionId"],
|
|
18
|
-
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSessionForSiop } "
|
|
19
|
-
},
|
|
20
|
-
IRegisterSiopSessionArgs: {
|
|
21
|
-
type: "object",
|
|
22
|
-
properties: {
|
|
23
|
-
identifier: {
|
|
26
|
+
IRegisterSiopSessionArgs: {
|
|
24
27
|
type: "object",
|
|
25
28
|
properties: {
|
|
26
|
-
|
|
29
|
+
identifier: {
|
|
30
|
+
type: "object",
|
|
31
|
+
properties: {
|
|
32
|
+
did: {
|
|
33
|
+
type: "string"
|
|
34
|
+
},
|
|
35
|
+
alias: {
|
|
36
|
+
type: "string"
|
|
37
|
+
},
|
|
38
|
+
provider: {
|
|
39
|
+
type: "string"
|
|
40
|
+
},
|
|
41
|
+
controllerKeyId: {
|
|
42
|
+
type: "string"
|
|
43
|
+
},
|
|
44
|
+
keys: {
|
|
45
|
+
type: "array",
|
|
46
|
+
items: {
|
|
47
|
+
type: "object",
|
|
48
|
+
properties: {
|
|
49
|
+
additionalProperties: true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
services: {
|
|
54
|
+
type: "array",
|
|
55
|
+
items: {
|
|
56
|
+
type: "object",
|
|
57
|
+
properties: {
|
|
58
|
+
additionalProperties: true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
additionalProperties: false,
|
|
64
|
+
required: ["did", "provider", "keys", "services"]
|
|
65
|
+
},
|
|
66
|
+
sessionId: {
|
|
27
67
|
type: "string"
|
|
28
68
|
},
|
|
29
|
-
|
|
69
|
+
expiresIn: {
|
|
70
|
+
type: "number"
|
|
71
|
+
},
|
|
72
|
+
additionalProperties: false
|
|
73
|
+
},
|
|
74
|
+
required: ["identifier"],
|
|
75
|
+
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } "
|
|
76
|
+
},
|
|
77
|
+
IRemoveSiopSessionArgs: {
|
|
78
|
+
type: "object",
|
|
79
|
+
properties: {
|
|
80
|
+
sessionId: {
|
|
30
81
|
type: "string"
|
|
31
82
|
},
|
|
32
|
-
|
|
83
|
+
additionalProperties: false
|
|
84
|
+
},
|
|
85
|
+
required: ["sessionId"],
|
|
86
|
+
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } "
|
|
87
|
+
},
|
|
88
|
+
IAuthenticateWithSiopArgs: {
|
|
89
|
+
type: "object",
|
|
90
|
+
properties: {
|
|
91
|
+
sessionId: {
|
|
33
92
|
type: "string"
|
|
34
93
|
},
|
|
35
|
-
|
|
94
|
+
stateId: {
|
|
36
95
|
type: "string"
|
|
37
96
|
},
|
|
38
|
-
|
|
39
|
-
type: "
|
|
40
|
-
items: {
|
|
41
|
-
type: "object",
|
|
42
|
-
properties: {
|
|
43
|
-
additionalProperties: true
|
|
44
|
-
}
|
|
45
|
-
}
|
|
97
|
+
redirectUrl: {
|
|
98
|
+
type: "string"
|
|
46
99
|
},
|
|
47
|
-
|
|
48
|
-
type: "array",
|
|
49
|
-
items: {
|
|
50
|
-
type: "object",
|
|
51
|
-
properties: {
|
|
52
|
-
additionalProperties: true
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
100
|
+
additionalProperties: false
|
|
56
101
|
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
},
|
|
60
|
-
sessionId: {
|
|
61
|
-
type: "string"
|
|
62
|
-
},
|
|
63
|
-
expiresIn: {
|
|
64
|
-
type: "number"
|
|
65
|
-
},
|
|
66
|
-
additionalProperties: false
|
|
67
|
-
},
|
|
68
|
-
required: ["identifier"],
|
|
69
|
-
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.registerSessionForSiop } "
|
|
70
|
-
},
|
|
71
|
-
IRemoveSiopSessionArgs: {
|
|
72
|
-
type: "object",
|
|
73
|
-
properties: {
|
|
74
|
-
sessionId: {
|
|
75
|
-
type: "string"
|
|
76
|
-
},
|
|
77
|
-
additionalProperties: false
|
|
78
|
-
},
|
|
79
|
-
required: ["sessionId"],
|
|
80
|
-
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.removeSessionForSiop } "
|
|
81
|
-
},
|
|
82
|
-
IAuthenticateWithSiopArgs: {
|
|
83
|
-
type: "object",
|
|
84
|
-
properties: {
|
|
85
|
-
sessionId: {
|
|
86
|
-
type: "string"
|
|
87
|
-
},
|
|
88
|
-
stateId: {
|
|
89
|
-
type: "string"
|
|
90
|
-
},
|
|
91
|
-
redirectUrl: {
|
|
92
|
-
type: "string"
|
|
93
|
-
},
|
|
94
|
-
additionalProperties: false
|
|
95
|
-
},
|
|
96
|
-
required: ["sessionId", "stateId", "redirectUrl"],
|
|
97
|
-
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } "
|
|
98
|
-
},
|
|
99
|
-
IResponse: {
|
|
100
|
-
type: "object",
|
|
101
|
-
properties: {
|
|
102
|
-
status: {
|
|
103
|
-
type: "number"
|
|
104
|
-
},
|
|
105
|
-
additionalProperties: true
|
|
106
|
-
},
|
|
107
|
-
required: ["status"],
|
|
108
|
-
description: "Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
|
|
109
|
-
},
|
|
110
|
-
IGetSiopAuthenticationRequestFromRpArgs: {
|
|
111
|
-
type: "object",
|
|
112
|
-
properties: {
|
|
113
|
-
sessionId: {
|
|
114
|
-
type: "string"
|
|
115
|
-
},
|
|
116
|
-
stateId: {
|
|
117
|
-
type: "string"
|
|
118
|
-
},
|
|
119
|
-
redirectUrl: {
|
|
120
|
-
type: "string"
|
|
121
|
-
},
|
|
122
|
-
additionalProperties: false
|
|
123
|
-
},
|
|
124
|
-
required: ["sessionId", "stateId", "redirectUrl"],
|
|
125
|
-
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
|
|
126
|
-
},
|
|
127
|
-
ParsedAuthenticationRequestURI: {
|
|
128
|
-
type: "object",
|
|
129
|
-
properties: {
|
|
130
|
-
jwt: {
|
|
131
|
-
type: "string"
|
|
102
|
+
required: ["sessionId", "stateId", "redirectUrl"],
|
|
103
|
+
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.authenticateWithSiop } "
|
|
132
104
|
},
|
|
133
|
-
|
|
105
|
+
IResponse: {
|
|
134
106
|
type: "object",
|
|
135
107
|
properties: {
|
|
108
|
+
status: {
|
|
109
|
+
type: "number"
|
|
110
|
+
},
|
|
136
111
|
additionalProperties: true
|
|
137
|
-
}
|
|
112
|
+
},
|
|
113
|
+
required: ["status"],
|
|
114
|
+
description: "Result of {@link DidAuthSiopOpAuthenticator.authenticateWithSiop & DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
|
|
138
115
|
},
|
|
139
|
-
|
|
116
|
+
IGetSiopAuthenticationRequestFromRpArgs: {
|
|
140
117
|
type: "object",
|
|
141
118
|
properties: {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
119
|
+
sessionId: {
|
|
120
|
+
type: "string"
|
|
121
|
+
},
|
|
122
|
+
stateId: {
|
|
123
|
+
type: "string"
|
|
124
|
+
},
|
|
125
|
+
redirectUrl: {
|
|
126
|
+
type: "string"
|
|
127
|
+
},
|
|
128
|
+
additionalProperties: false
|
|
129
|
+
},
|
|
130
|
+
required: ["sessionId", "stateId", "redirectUrl"],
|
|
131
|
+
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
|
|
155
132
|
},
|
|
156
|
-
|
|
133
|
+
ParsedAuthenticationRequestURI: {
|
|
157
134
|
type: "object",
|
|
158
135
|
properties: {
|
|
159
|
-
|
|
160
|
-
|
|
136
|
+
jwt: {
|
|
137
|
+
type: "string"
|
|
138
|
+
},
|
|
139
|
+
requestPayload: {
|
|
140
|
+
type: "object",
|
|
141
|
+
properties: {
|
|
142
|
+
additionalProperties: true
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
registration: {
|
|
146
|
+
type: "object",
|
|
147
|
+
properties: {
|
|
148
|
+
additionalProperties: true
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
additionalProperties: false
|
|
152
|
+
},
|
|
153
|
+
required: ["jwt", "requestPayload", "registration"],
|
|
154
|
+
description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestFromRP } "
|
|
161
155
|
},
|
|
162
|
-
|
|
156
|
+
IGetSiopAuthenticationRequestDetailsArgs: {
|
|
163
157
|
type: "object",
|
|
164
158
|
properties: {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
159
|
+
sessionId: {
|
|
160
|
+
type: "string"
|
|
161
|
+
},
|
|
162
|
+
verifiedAuthenticationRequest: {
|
|
163
|
+
type: "object",
|
|
164
|
+
properties: {
|
|
165
|
+
additionalProperties: true
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
credentialFilter: {
|
|
169
|
+
type: "object",
|
|
170
|
+
properties: {
|
|
171
|
+
additionalProperties: true
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
additionalProperties: false
|
|
175
|
+
},
|
|
176
|
+
required: ["sessionId", "verifiedAuthenticationRequest"],
|
|
177
|
+
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
|
|
184
178
|
},
|
|
185
|
-
|
|
179
|
+
IAuthRequestDetails: {
|
|
186
180
|
type: "object",
|
|
187
181
|
properties: {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
182
|
+
id: {
|
|
183
|
+
type: "string"
|
|
184
|
+
},
|
|
185
|
+
alsoKnownAs: {
|
|
186
|
+
type: "array",
|
|
187
|
+
items: {
|
|
188
|
+
type: "string"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
vpResponseOpts: {
|
|
192
|
+
type: "object",
|
|
193
|
+
properties: {
|
|
194
|
+
additionalProperties: true
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
additionalProperties: false
|
|
198
|
+
},
|
|
199
|
+
required: ["id", "vpResponseOpts"],
|
|
200
|
+
description: "Result of {@link DidAuthSiopOpAuthenticator.getSiopAuthenticationRequestDetails } "
|
|
201
201
|
},
|
|
202
|
-
|
|
202
|
+
IVerifySiopAuthenticationRequestUriArgs: {
|
|
203
203
|
type: "object",
|
|
204
204
|
properties: {
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
sessionId: {
|
|
206
|
+
type: "string"
|
|
207
|
+
},
|
|
208
|
+
ParsedAuthenticationRequestURI: {
|
|
209
|
+
type: "object",
|
|
210
|
+
properties: {
|
|
211
|
+
additionalProperties: true
|
|
212
|
+
}
|
|
213
|
+
},
|
|
214
|
+
additionalProperties: false
|
|
215
|
+
},
|
|
216
|
+
required: ["sessionId", "ParsedAuthenticationRequestURI"],
|
|
217
|
+
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
|
|
207
218
|
},
|
|
208
|
-
|
|
209
|
-
},
|
|
210
|
-
required: ["sessionId", "ParsedAuthenticationRequestURI"],
|
|
211
|
-
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
|
|
212
|
-
},
|
|
213
|
-
VerifiedAuthorizationRequest: {
|
|
214
|
-
type: "object",
|
|
215
|
-
properties: {
|
|
216
|
-
payload: {
|
|
219
|
+
VerifiedAuthorizationRequest: {
|
|
217
220
|
type: "object",
|
|
218
221
|
properties: {
|
|
219
|
-
|
|
220
|
-
|
|
222
|
+
payload: {
|
|
223
|
+
type: "object",
|
|
224
|
+
properties: {
|
|
225
|
+
additionalProperties: true
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
presentationDefinitions: {
|
|
229
|
+
type: "object",
|
|
230
|
+
properties: {
|
|
231
|
+
additionalProperties: true
|
|
232
|
+
}
|
|
233
|
+
},
|
|
234
|
+
verifyOpts: {
|
|
235
|
+
type: "object",
|
|
236
|
+
properties: {
|
|
237
|
+
additionalProperties: true
|
|
238
|
+
}
|
|
239
|
+
},
|
|
240
|
+
additionalProperties: false
|
|
241
|
+
},
|
|
242
|
+
required: ["payload", "verifyOpts"],
|
|
243
|
+
description: "Result of {@link DidAuthSiopOpAuthenticator.verifySiopAuthenticationRequestURI } "
|
|
221
244
|
},
|
|
222
|
-
|
|
245
|
+
ISendSiopAuthenticationResponseArgs: {
|
|
223
246
|
type: "object",
|
|
224
247
|
properties: {
|
|
225
|
-
|
|
226
|
-
|
|
248
|
+
sessionId: {
|
|
249
|
+
type: "string"
|
|
250
|
+
},
|
|
251
|
+
verifiedAuthenticationRequest: {
|
|
252
|
+
type: "object",
|
|
253
|
+
properties: {
|
|
254
|
+
additionalProperties: true
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
verifiablePresentationResponse: {
|
|
258
|
+
type: "object",
|
|
259
|
+
properties: {
|
|
260
|
+
additionalProperties: true
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
additionalProperties: false
|
|
264
|
+
},
|
|
265
|
+
required: ["sessionId", "verifiedAuthenticationRequest"],
|
|
266
|
+
description: "Arguments needed for {@link DidAuthSiopOpAuthenticator.sendSiopAuthenticationResponse } "
|
|
267
|
+
}
|
|
268
|
+
},
|
|
269
|
+
methods: {
|
|
270
|
+
getSessionForSiop: {
|
|
271
|
+
description: "Get SIOP session",
|
|
272
|
+
arguments: {
|
|
273
|
+
$ref: "#/components/schemas/IGetSiopSessionArgs"
|
|
274
|
+
},
|
|
275
|
+
returnType: "object"
|
|
227
276
|
},
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
277
|
+
registerSessionForSiop: {
|
|
278
|
+
description: "Register SIOP session",
|
|
279
|
+
arguments: {
|
|
280
|
+
$ref: "#/components/schemas/IRegisterSiopSessionArgs"
|
|
281
|
+
},
|
|
282
|
+
returnType: "object"
|
|
283
|
+
},
|
|
284
|
+
removeSessionForSiop: {
|
|
285
|
+
description: "Remove SIOP session",
|
|
286
|
+
arguments: {
|
|
287
|
+
$ref: "#/components/schemas/IRemoveSiopSessionArgs"
|
|
288
|
+
},
|
|
289
|
+
returnType: "boolean"
|
|
290
|
+
},
|
|
291
|
+
authenticateWithSiop: {
|
|
292
|
+
description: "Authenticate using DID Auth SIOP",
|
|
293
|
+
arguments: {
|
|
294
|
+
$ref: "#/components/schemas/IAuthenticateWithSiopArgs"
|
|
295
|
+
},
|
|
296
|
+
returnType: {
|
|
297
|
+
$ref: "#/components/schemas/Response"
|
|
232
298
|
}
|
|
233
299
|
},
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
sessionId: {
|
|
243
|
-
type: "string"
|
|
300
|
+
getSiopAuthenticationRequestFromRP: {
|
|
301
|
+
description: "Get authentication request from RP",
|
|
302
|
+
arguments: {
|
|
303
|
+
$ref: "#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs"
|
|
304
|
+
},
|
|
305
|
+
returnType: {
|
|
306
|
+
$ref: "#/components/schemas/ParsedAuthenticationRequestURI"
|
|
307
|
+
}
|
|
244
308
|
},
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
309
|
+
getSiopAuthenticationRequestDetails: {
|
|
310
|
+
description: "Get authentication request details",
|
|
311
|
+
arguments: {
|
|
312
|
+
$ref: "#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs"
|
|
313
|
+
},
|
|
314
|
+
returnType: {
|
|
315
|
+
$ref: "#/components/schemas/IAuthRequestDetails"
|
|
249
316
|
}
|
|
250
317
|
},
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
318
|
+
verifySiopAuthenticationRequestURI: {
|
|
319
|
+
description: "Verify authentication request URI",
|
|
320
|
+
arguments: {
|
|
321
|
+
$ref: "#/components/schemas/IVerifySiopAuthenticationRequestUriArgs"
|
|
322
|
+
},
|
|
323
|
+
returnType: {
|
|
324
|
+
$ref: "#/components/schemas/VerifiedAuthorizationRequest"
|
|
255
325
|
}
|
|
256
326
|
},
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
arguments: {
|
|
267
|
-
$ref: "#/components/schemas/IGetSiopSessionArgs"
|
|
268
|
-
},
|
|
269
|
-
returnType: "object"
|
|
270
|
-
},
|
|
271
|
-
registerSessionForSiop: {
|
|
272
|
-
description: "Register SIOP session",
|
|
273
|
-
arguments: {
|
|
274
|
-
$ref: "#/components/schemas/IRegisterSiopSessionArgs"
|
|
275
|
-
},
|
|
276
|
-
returnType: "object"
|
|
277
|
-
},
|
|
278
|
-
removeSessionForSiop: {
|
|
279
|
-
description: "Remove SIOP session",
|
|
280
|
-
arguments: {
|
|
281
|
-
$ref: "#/components/schemas/IRemoveSiopSessionArgs"
|
|
282
|
-
},
|
|
283
|
-
returnType: "boolean"
|
|
284
|
-
},
|
|
285
|
-
authenticateWithSiop: {
|
|
286
|
-
description: "Authenticate using DID Auth SIOP",
|
|
287
|
-
arguments: {
|
|
288
|
-
$ref: "#/components/schemas/IAuthenticateWithSiopArgs"
|
|
289
|
-
},
|
|
290
|
-
returnType: {
|
|
291
|
-
$ref: "#/components/schemas/Response"
|
|
292
|
-
}
|
|
293
|
-
},
|
|
294
|
-
getSiopAuthenticationRequestFromRP: {
|
|
295
|
-
description: "Get authentication request from RP",
|
|
296
|
-
arguments: {
|
|
297
|
-
$ref: "#/components/schemas/IGetSiopAuthenticationRequestFromRpArgs"
|
|
298
|
-
},
|
|
299
|
-
returnType: {
|
|
300
|
-
$ref: "#/components/schemas/ParsedAuthenticationRequestURI"
|
|
301
|
-
}
|
|
302
|
-
},
|
|
303
|
-
getSiopAuthenticationRequestDetails: {
|
|
304
|
-
description: "Get authentication request details",
|
|
305
|
-
arguments: {
|
|
306
|
-
$ref: "#/components/schemas/IGetSiopAuthenticationRequestDetailsArgs"
|
|
307
|
-
},
|
|
308
|
-
returnType: {
|
|
309
|
-
$ref: "#/components/schemas/IAuthRequestDetails"
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
verifySiopAuthenticationRequestURI: {
|
|
313
|
-
description: "Verify authentication request URI",
|
|
314
|
-
arguments: {
|
|
315
|
-
$ref: "#/components/schemas/IVerifySiopAuthenticationRequestUriArgs"
|
|
316
|
-
},
|
|
317
|
-
returnType: {
|
|
318
|
-
$ref: "#/components/schemas/VerifiedAuthorizationRequest"
|
|
319
|
-
}
|
|
320
|
-
},
|
|
321
|
-
sendSiopAuthenticationResponse: {
|
|
322
|
-
description: "Send authentication response",
|
|
323
|
-
arguments: {
|
|
324
|
-
$ref: "#/components/schemas/ISendSiopAuthenticationResponseArgs"
|
|
325
|
-
},
|
|
326
|
-
returnType: {
|
|
327
|
-
$ref: "#/components/schemas/IRequiredContext"
|
|
327
|
+
sendSiopAuthenticationResponse: {
|
|
328
|
+
description: "Send authentication response",
|
|
329
|
+
arguments: {
|
|
330
|
+
$ref: "#/components/schemas/ISendSiopAuthenticationResponseArgs"
|
|
331
|
+
},
|
|
332
|
+
returnType: {
|
|
333
|
+
$ref: "#/components/schemas/IRequiredContext"
|
|
334
|
+
}
|
|
335
|
+
}
|
|
328
336
|
}
|
|
329
337
|
}
|
|
330
338
|
}
|
|
331
|
-
}
|
|
339
|
+
};
|
|
332
340
|
}
|
|
333
|
-
};
|
|
341
|
+
});
|
|
334
342
|
|
|
335
343
|
// src/agent/SIOPv2RP.ts
|
|
336
344
|
import { AuthorizationResponseStateStatus, decodeUriAsJson } from "@sphereon/did-auth-siop";
|
|
337
345
|
import { getAgentResolver as getAgentResolver2 } from "@sphereon/ssi-sdk-ext.did-utils";
|
|
338
346
|
import { CredentialMapper as CredentialMapper2 } from "@sphereon/ssi-types";
|
|
347
|
+
import { DcqlQuery } from "dcql";
|
|
339
348
|
|
|
340
349
|
// src/functions.ts
|
|
341
350
|
import { InMemoryRPSessionManager, PassBy, PropertyTarget, ResponseMode, ResponseType, RevocationVerification, RP, Scope, SubjectType, SupportedVersion } from "@sphereon/did-auth-siop";
|
|
@@ -408,11 +417,11 @@ async function createRPBuilder(args) {
|
|
|
408
417
|
const { identifierOpts } = rpOpts;
|
|
409
418
|
let definition = args.definition;
|
|
410
419
|
let dcqlQuery = args.dcql;
|
|
411
|
-
if (!definition && pexOpts && pexOpts.
|
|
420
|
+
if (!definition && pexOpts && pexOpts.definitionId) {
|
|
412
421
|
const presentationDefinitionItems = await context.agent.pdmGetDefinitions({
|
|
413
422
|
filter: [
|
|
414
423
|
{
|
|
415
|
-
definitionId: pexOpts.
|
|
424
|
+
definitionId: pexOpts.definitionId,
|
|
416
425
|
version: pexOpts.version,
|
|
417
426
|
tenantId: pexOpts.tenantId
|
|
418
427
|
}
|
|
@@ -600,7 +609,7 @@ var RPInstance = class {
|
|
|
600
609
|
return this.definitionId !== void 0;
|
|
601
610
|
}
|
|
602
611
|
get definitionId() {
|
|
603
|
-
return this.pexOptions?.
|
|
612
|
+
return this.pexOptions?.definitionId;
|
|
604
613
|
}
|
|
605
614
|
async getPresentationDefinition(context) {
|
|
606
615
|
return this.definitionId ? await context.agent.pexStoreGetDefinition({
|
|
@@ -609,7 +618,7 @@ var RPInstance = class {
|
|
|
609
618
|
}) : void 0;
|
|
610
619
|
}
|
|
611
620
|
async createAuthorizationRequestURI(createArgs, context) {
|
|
612
|
-
const { correlationId, claims, requestByReferenceURI, responseURI, responseURIType
|
|
621
|
+
const { correlationId, claims, requestByReferenceURI, responseURI, responseURIType } = createArgs;
|
|
613
622
|
const nonce = createArgs.nonce ?? uuidv4();
|
|
614
623
|
const state = createArgs.state ?? correlationId;
|
|
615
624
|
let jwtIssuer;
|
|
@@ -643,8 +652,7 @@ var RPInstance = class {
|
|
|
643
652
|
requestByReferenceURI,
|
|
644
653
|
responseURI,
|
|
645
654
|
responseURIType,
|
|
646
|
-
jwtIssuer
|
|
647
|
-
callback
|
|
655
|
+
jwtIssuer
|
|
648
656
|
}));
|
|
649
657
|
}
|
|
650
658
|
async createAuthorizationRequest(createArgs, context) {
|
|
@@ -693,7 +701,7 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
693
701
|
opts;
|
|
694
702
|
static _DEFAULT_OPTS_KEY = "_default";
|
|
695
703
|
instances = /* @__PURE__ */ new Map();
|
|
696
|
-
schema =
|
|
704
|
+
schema = schema.IDidAuthSiopOpAuthenticator;
|
|
697
705
|
methods = {
|
|
698
706
|
siopCreateAuthRequestURI: this.createAuthorizationRequestURI.bind(this),
|
|
699
707
|
siopCreateAuthRequestPayloads: this.createAuthorizationRequestPayloads.bind(this),
|
|
@@ -723,32 +731,30 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
723
731
|
}
|
|
724
732
|
async createAuthorizationRequestURI(createArgs, context) {
|
|
725
733
|
return await this.getRPInstance({
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
queryId: createArgs.queryId
|
|
729
|
-
}
|
|
734
|
+
definitionId: createArgs.definitionId,
|
|
735
|
+
responseRedirectURI: createArgs.responseRedirectURI
|
|
730
736
|
}, context).then((rp) => rp.createAuthorizationRequestURI(createArgs, context)).then((URI) => URI.encodedUri);
|
|
731
737
|
}
|
|
732
738
|
async createAuthorizationRequestPayloads(createArgs, context) {
|
|
733
739
|
return await this.getRPInstance({
|
|
734
|
-
|
|
740
|
+
definitionId: createArgs.definitionId
|
|
735
741
|
}, context).then((rp) => rp.createAuthorizationRequest(createArgs, context)).then(async (request) => {
|
|
736
742
|
const authRequest = {
|
|
737
743
|
authorizationRequest: request.payload,
|
|
738
744
|
requestObject: await request.requestObjectJwt(),
|
|
739
|
-
requestObjectDecoded: request.requestObject?.getPayload()
|
|
745
|
+
requestObjectDecoded: await request.requestObject?.getPayload()
|
|
740
746
|
};
|
|
741
747
|
return authRequest;
|
|
742
748
|
});
|
|
743
749
|
}
|
|
744
750
|
async siopGetRequestState(args, context) {
|
|
745
751
|
return await this.getRPInstance({
|
|
746
|
-
|
|
752
|
+
definitionId: args.definitionId
|
|
747
753
|
}, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.getRequestStateByCorrelationId(args.correlationId, args.errorOnNotFound)));
|
|
748
754
|
}
|
|
749
755
|
async siopGetResponseState(args, context) {
|
|
750
756
|
const rpInstance = await this.getRPInstance({
|
|
751
|
-
|
|
757
|
+
definitionId: args.definitionId
|
|
752
758
|
}, context);
|
|
753
759
|
const authorizationResponseState = await rpInstance.get(context).then((rp) => rp.sessionManager.getResponseStateByCorrelationId(args.correlationId, args.errorOnNotFound));
|
|
754
760
|
if (authorizationResponseState === void 0) {
|
|
@@ -801,11 +807,11 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
801
807
|
}
|
|
802
808
|
presentationOrClaimsFrom = /* @__PURE__ */ __name((presentationDecoded) => CredentialMapper2.isSdJwtDecodedCredential(presentationDecoded) ? presentationDecoded.decodedPayload : CredentialMapper2.toUniformPresentation(presentationDecoded), "presentationOrClaimsFrom");
|
|
803
809
|
async siopUpdateRequestState(args, context) {
|
|
804
|
-
if (args.state !== "
|
|
805
|
-
throw Error(`Only '
|
|
810
|
+
if (args.state !== "sent") {
|
|
811
|
+
throw Error(`Only 'sent' status is supported for this method at this point`);
|
|
806
812
|
}
|
|
807
813
|
return await this.getRPInstance({
|
|
808
|
-
|
|
814
|
+
definitionId: args.definitionId
|
|
809
815
|
}, context).then((rp) => rp.get(context).then(async (rp2) => {
|
|
810
816
|
await rp2.signalAuthRequestRetrieved({
|
|
811
817
|
correlationId: args.correlationId,
|
|
@@ -816,7 +822,7 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
816
822
|
}
|
|
817
823
|
async siopDeleteState(args, context) {
|
|
818
824
|
return await this.getRPInstance({
|
|
819
|
-
|
|
825
|
+
definitionId: args.definitionId
|
|
820
826
|
}, context).then((rp) => rp.get(context).then((rp2) => rp2.sessionManager.deleteStateForCorrelationId(args.correlationId))).then(() => true);
|
|
821
827
|
}
|
|
822
828
|
async siopVerifyAuthResponse(args, context) {
|
|
@@ -825,28 +831,38 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
825
831
|
}
|
|
826
832
|
const authResponse = typeof args.authorizationResponse === "string" ? decodeUriAsJson(args.authorizationResponse) : args.authorizationResponse;
|
|
827
833
|
return await this.getRPInstance({
|
|
828
|
-
|
|
834
|
+
definitionId: args.definitionId
|
|
829
835
|
}, context).then((rp) => rp.get(context).then((rp2) => rp2.verifyAuthorizationResponse(authResponse, {
|
|
830
836
|
correlationId: args.correlationId,
|
|
831
|
-
...args.
|
|
832
|
-
|
|
833
|
-
} : {},
|
|
834
|
-
...args.dcqlQuery ? {
|
|
835
|
-
dcqlQuery: args.dcqlQuery
|
|
837
|
+
...args.dcqlQueryPayload ? {
|
|
838
|
+
dcqlQuery: args.dcqlQueryPayload.dcqlQuery
|
|
836
839
|
} : {},
|
|
837
840
|
audience: args.audience
|
|
838
841
|
})));
|
|
839
842
|
}
|
|
840
843
|
async siopImportDefinitions(args, context) {
|
|
841
|
-
const {
|
|
842
|
-
await Promise.all(
|
|
844
|
+
const { definitions, tenantId, version, versionControlMode } = args;
|
|
845
|
+
await Promise.all(definitions.map(async (definitionPair) => {
|
|
843
846
|
const definitionPayload = definitionPair.definitionPayload;
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
}
|
|
847
|
-
|
|
847
|
+
if (!definitionPayload && !definitionPair.dcqlPayload) {
|
|
848
|
+
return Promise.reject(Error("Either dcqlPayload or definitionPayload must be suppplied"));
|
|
849
|
+
}
|
|
850
|
+
let definitionId;
|
|
851
|
+
if (definitionPair.dcqlPayload) {
|
|
852
|
+
DcqlQuery.validate(definitionPair.dcqlPayload.dcqlQuery);
|
|
853
|
+
console.log(`persisting DCQL definition ${definitionPair.dcqlPayload.queryId} with versionControlMode ${versionControlMode}`);
|
|
854
|
+
definitionId = definitionPair.dcqlPayload.queryId;
|
|
855
|
+
}
|
|
856
|
+
if (definitionPayload) {
|
|
857
|
+
await context.agent.pexValidateDefinition({
|
|
858
|
+
definition: definitionPayload
|
|
859
|
+
});
|
|
860
|
+
console.log(`persisting PEX definition ${definitionPayload.id} / ${definitionPayload.name} with versionControlMode ${versionControlMode}`);
|
|
861
|
+
definitionId = definitionPayload.id;
|
|
862
|
+
}
|
|
848
863
|
return context.agent.pdmPersistDefinition({
|
|
849
864
|
definitionItem: {
|
|
865
|
+
definitionId,
|
|
850
866
|
tenantId,
|
|
851
867
|
version,
|
|
852
868
|
definitionPayload,
|
|
@@ -859,7 +875,7 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
859
875
|
}));
|
|
860
876
|
}
|
|
861
877
|
async siopGetRedirectURI(args, context) {
|
|
862
|
-
const instanceId = args.
|
|
878
|
+
const instanceId = args.definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
|
|
863
879
|
if (this.instances.has(instanceId)) {
|
|
864
880
|
const rpInstance = this.instances.get(instanceId);
|
|
865
881
|
if (rpInstance !== void 0) {
|
|
@@ -875,12 +891,12 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
875
891
|
}
|
|
876
892
|
return void 0;
|
|
877
893
|
}
|
|
878
|
-
async getRPInstance({
|
|
879
|
-
const instanceId =
|
|
894
|
+
async getRPInstance({ definitionId, responseRedirectURI }, context) {
|
|
895
|
+
const instanceId = definitionId ?? _SIOPv2RP._DEFAULT_OPTS_KEY;
|
|
880
896
|
if (!this.instances.has(instanceId)) {
|
|
881
|
-
const instanceOpts = this.getInstanceOpts(
|
|
897
|
+
const instanceOpts = this.getInstanceOpts(definitionId);
|
|
882
898
|
const rpOpts = await this.getRPOptions(context, {
|
|
883
|
-
|
|
899
|
+
definitionId,
|
|
884
900
|
responseRedirectURI
|
|
885
901
|
});
|
|
886
902
|
if (!rpOpts.identifierOpts.resolveOpts?.resolver || typeof rpOpts.identifierOpts.resolveOpts.resolver.resolve !== "function") {
|
|
@@ -892,7 +908,7 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
892
908
|
...rpOpts.identifierOpts.resolveOpts
|
|
893
909
|
};
|
|
894
910
|
}
|
|
895
|
-
console.log("Using agent DID resolver for RP instance with definition id " +
|
|
911
|
+
console.log("Using agent DID resolver for RP instance with definition id " + definitionId);
|
|
896
912
|
rpOpts.identifierOpts.resolveOpts.resolver = getAgentResolver2(context, {
|
|
897
913
|
uniresolverResolution: true,
|
|
898
914
|
localResolution: true,
|
|
@@ -911,10 +927,10 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
911
927
|
return rpInstance;
|
|
912
928
|
}
|
|
913
929
|
async getRPOptions(context, opts) {
|
|
914
|
-
const {
|
|
915
|
-
const options = this.getInstanceOpts(
|
|
930
|
+
const { definitionId, responseRedirectURI } = opts;
|
|
931
|
+
const options = this.getInstanceOpts(definitionId)?.rpOpts ?? this.opts.defaultOpts;
|
|
916
932
|
if (!options) {
|
|
917
|
-
throw Error(`Could not get specific nor default options for definition ${
|
|
933
|
+
throw Error(`Could not get specific nor default options for definition ${definitionId}`);
|
|
918
934
|
}
|
|
919
935
|
if (this.opts.defaultOpts) {
|
|
920
936
|
if (!options.identifierOpts) {
|
|
@@ -948,18 +964,18 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
948
964
|
}
|
|
949
965
|
getInstanceOpts(definitionId) {
|
|
950
966
|
if (!this.opts.instanceOpts) return void 0;
|
|
951
|
-
const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.
|
|
967
|
+
const instanceOpt = definitionId ? this.opts.instanceOpts.find((i) => i.definitionId === definitionId) : void 0;
|
|
952
968
|
return instanceOpt ?? this.getDefaultOptions(definitionId);
|
|
953
969
|
}
|
|
954
970
|
getDefaultOptions(definitionId) {
|
|
955
971
|
if (!this.opts.instanceOpts) return void 0;
|
|
956
|
-
const defaultOptions = this.opts.instanceOpts.find((i) => i.
|
|
972
|
+
const defaultOptions = this.opts.instanceOpts.find((i) => i.definitionId === "default");
|
|
957
973
|
if (defaultOptions) {
|
|
958
974
|
const clonedOptions = {
|
|
959
975
|
...defaultOptions
|
|
960
976
|
};
|
|
961
977
|
if (definitionId !== void 0) {
|
|
962
|
-
clonedOptions.
|
|
978
|
+
clonedOptions.definitionId = definitionId;
|
|
963
979
|
}
|
|
964
980
|
return clonedOptions;
|
|
965
981
|
}
|
|
@@ -968,15 +984,18 @@ var SIOPv2RP = class _SIOPv2RP {
|
|
|
968
984
|
};
|
|
969
985
|
|
|
970
986
|
// src/types/ISIOPv2RP.ts
|
|
971
|
-
var VerifiedDataMode = /* @__PURE__ */
|
|
987
|
+
var VerifiedDataMode = /* @__PURE__ */ function(VerifiedDataMode2) {
|
|
972
988
|
VerifiedDataMode2["NONE"] = "none";
|
|
973
989
|
VerifiedDataMode2["VERIFIED_PRESENTATION"] = "vp";
|
|
974
990
|
VerifiedDataMode2["CREDENTIAL_SUBJECT_FLATTENED"] = "cs-flat";
|
|
975
991
|
return VerifiedDataMode2;
|
|
976
|
-
}
|
|
992
|
+
}({});
|
|
993
|
+
|
|
994
|
+
// src/index.ts
|
|
995
|
+
var schema = require_plugin_schema();
|
|
977
996
|
export {
|
|
978
997
|
SIOPv2RP,
|
|
979
998
|
VerifiedDataMode,
|
|
980
|
-
|
|
999
|
+
schema
|
|
981
1000
|
};
|
|
982
1001
|
//# sourceMappingURL=index.js.map
|