@digitalbazaar/oid4-client 5.9.0 → 5.9.1
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/lib/convert/index.js +16 -5
- package/package.json +1 -1
package/lib/convert/index.js
CHANGED
|
@@ -62,11 +62,18 @@ export function fromVpr({
|
|
|
62
62
|
if(verifiablePresentationRequest.domain) {
|
|
63
63
|
// since a `domain` was provided, set these defaults:
|
|
64
64
|
authorizationRequest.client_id = verifiablePresentationRequest.domain;
|
|
65
|
-
|
|
65
|
+
const usesRedirectUriPrefix =
|
|
66
|
+
authorizationRequest.client_id?.startsWith('redirect_uri:');
|
|
67
|
+
authorizationRequest.response_uri = usesRedirectUriPrefix ?
|
|
68
|
+
authorizationRequest.client_id.slice('redirect_uri:'.length) :
|
|
69
|
+
authorizationRequest.client_id;
|
|
66
70
|
if(useClientIdPrefix) {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
if(!usesRedirectUriPrefix) {
|
|
72
|
+
authorizationRequest.client_id =
|
|
73
|
+
`redirect_uri:${authorizationRequest.client_id}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if(usesRedirectUriPrefix) {
|
|
70
77
|
authorizationRequest.client_id_scheme = 'redirect_uri';
|
|
71
78
|
}
|
|
72
79
|
}
|
|
@@ -137,6 +144,7 @@ export function toVpr({authorizationRequest, strict = false} = {}) {
|
|
|
137
144
|
|
|
138
145
|
const {
|
|
139
146
|
client_id,
|
|
147
|
+
client_id_scheme,
|
|
140
148
|
client_metadata,
|
|
141
149
|
dcql_query,
|
|
142
150
|
expected_origins,
|
|
@@ -188,11 +196,14 @@ export function toVpr({authorizationRequest, strict = false} = {}) {
|
|
|
188
196
|
verifiablePresentationRequest.query = [didAuthnQuery];
|
|
189
197
|
}
|
|
190
198
|
|
|
191
|
-
// map `expected_origins`
|
|
199
|
+
// map `expected_origins` / `client_id` / `response_uri` to `domain`
|
|
192
200
|
if(response_uri !== undefined || client_id !== undefined) {
|
|
193
201
|
if(response_mode?.startsWith('dc_api') && !response_uri &&
|
|
194
202
|
expected_origins?.length > 0) {
|
|
195
203
|
verifiablePresentationRequest.domain = expected_origins[0];
|
|
204
|
+
} else if(client_id_scheme === 'redirect_uri' ||
|
|
205
|
+
client_id?.startsWith('redirect_uri:')) {
|
|
206
|
+
verifiablePresentationRequest.domain = client_id ?? response_uri;
|
|
196
207
|
} else {
|
|
197
208
|
verifiablePresentationRequest.domain = response_uri;
|
|
198
209
|
}
|