@@ -179,9 +179,12 @@ export default {
179179 } else if (offerUrl) {
180180 credentialRequestOrigin .value = new URL (offerUrl).origin ;
181181 }
182- return ;
182+ } else if (url .protocol === ' openid4vp:' ) {
183+ const offerUrl = url .searchParams .get (' request_uri' );
184+ credentialRequestOrigin .value = new URL (offerUrl).origin ;
185+ } else {
186+ credentialRequestOrigin .value = url .origin ;
183187 }
184- credentialRequestOrigin .value = url .origin ;
185188 }
186189
187190 async function handleQrCode ({text, type}) {
@@ -192,13 +195,16 @@ export default {
192195 const url = new URL (text);
193196 getRequestOrigin (url);
194197 const multiProtocol = url .protocol === ' https:' ;
195- const isOpenId = url .protocol === ' openid-credential-offer:' ;
198+ const isOID4VCI = url .protocol === ' openid-credential-offer:' ;
199+ const isOID4VP = url .protocol === ' openid4vp:' ;
196200 if (multiProtocol) {
197201 const headers = {headers: {accept: ' application/json' }};
198202 const {data } = await httpClient .get (text, {headers});
199203 protocols = data .protocols ;
200- } else if (isOpenId ) {
204+ } else if (isOID4VCI ) {
201205 protocols = {OID4VCI : text};
206+ } else if (isOID4VP) {
207+ protocols = {OID4VP : text};
202208 }
203209 if (! protocols) {
204210 throw new Error (' Unable to handle scanned QR code.' );
@@ -291,13 +297,14 @@ export default {
291297 throw e;
292298 }
293299 if (done) {
294- // exchange is finished
295- exchange .value .close ();
300+ const action = display .value === ' store' ? ' stored' : ' shared' ;
296301 $q .notify ({
297302 type: ' positive' ,
298- message: ' Successfully stored credential' ,
303+ message: ` Successfully ${ action } credential` ,
299304 });
300305 router .push ({name: ' home' });
306+ // exchange is finished
307+ exchange .value .close ();
301308 break ;
302309 }
303310 }
0 commit comments