@learncard/chapi-plugin 1.0.78 → 1.1.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/dist/chapi-plugin.cjs.development.js +401 -150
- package/dist/chapi-plugin.cjs.development.js.map +1 -1
- package/dist/chapi-plugin.cjs.production.min.js +121 -77
- package/dist/chapi-plugin.cjs.production.min.js.map +2 -2
- package/dist/chapi-plugin.esm.js +398 -147
- package/dist/chapi-plugin.esm.js.map +1 -1
- package/package.json +8 -8
package/dist/chapi-plugin.esm.js
CHANGED
|
@@ -62,6 +62,8 @@ function parseUrl(url, base) {
|
|
|
62
62
|
pathname = "/" + pathname;
|
|
63
63
|
}
|
|
64
64
|
return {
|
|
65
|
+
// TODO: is this safe for general use on every browser that doesn't
|
|
66
|
+
// support WHATWG URL?
|
|
65
67
|
host: parser.host || window.location.host,
|
|
66
68
|
hostname: parser.hostname,
|
|
67
69
|
origin,
|
|
@@ -71,8 +73,7 @@ function parseUrl(url, base) {
|
|
|
71
73
|
}
|
|
72
74
|
__name(parseUrl, "parseUrl");
|
|
73
75
|
function uuidv4(a, b) {
|
|
74
|
-
for (b = a = ""; a++ < 36; b += a * 51 & 52 ? (a ^ 15 ? 8 ^ Math.random() * (a ^ 20 ? 16 : 4) : 4).toString(16) : "-")
|
|
75
|
-
;
|
|
76
|
+
for (b = a = ""; a++ < 36; b += a * 51 & 52 ? (a ^ 15 ? 8 ^ Math.random() * (a ^ 20 ? 16 : 4) : 4).toString(16) : "-") ;
|
|
76
77
|
return b;
|
|
77
78
|
}
|
|
78
79
|
__name(uuidv4, "uuidv4");
|
|
@@ -161,13 +162,27 @@ __name(isHandlePromise, "isHandlePromise");
|
|
|
161
162
|
|
|
162
163
|
// ../../../node_modules/.pnpm/web-request-rpc@2.0.3/node_modules/web-request-rpc/Client.js
|
|
163
164
|
var RPC_CLIENT_CALL_TIMEOUT = 3e4;
|
|
164
|
-
var
|
|
165
|
+
var _Client = class _Client {
|
|
165
166
|
constructor() {
|
|
166
167
|
this.origin = null;
|
|
167
168
|
this._handle = null;
|
|
168
169
|
this._listener = null;
|
|
169
170
|
this._pending = /* @__PURE__ */ new Map();
|
|
170
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Connects to a Web Request RPC server.
|
|
174
|
+
*
|
|
175
|
+
* The Promise will resolve to an RPC injector that can be used to get or
|
|
176
|
+
* define APIs to enable communication with the server.
|
|
177
|
+
*
|
|
178
|
+
* @param origin the origin to send messages to.
|
|
179
|
+
* @param options the options to use:
|
|
180
|
+
* [handle] a handle to the window (or a Promise that resolves to
|
|
181
|
+
* a handle) to send messages to
|
|
182
|
+
* (defaults to `window.opener || window.parent`).
|
|
183
|
+
*
|
|
184
|
+
* @return a Promise that resolves to an RPC injector once connected.
|
|
185
|
+
*/
|
|
171
186
|
async connect(origin, options) {
|
|
172
187
|
if (this._listener) {
|
|
173
188
|
throw new Error("Already connected.");
|
|
@@ -181,7 +196,7 @@ var Client = class {
|
|
|
181
196
|
origin: self.origin,
|
|
182
197
|
handle: self._handle,
|
|
183
198
|
expectRequest: false,
|
|
184
|
-
listener: (message) => {
|
|
199
|
+
listener: /* @__PURE__ */ __name((message) => {
|
|
185
200
|
if (!pending.has(message.id)) {
|
|
186
201
|
return;
|
|
187
202
|
}
|
|
@@ -191,11 +206,23 @@ var Client = class {
|
|
|
191
206
|
return resolve(message.result);
|
|
192
207
|
}
|
|
193
208
|
reject(deserializeError(message.error));
|
|
194
|
-
}
|
|
209
|
+
}, "listener")
|
|
195
210
|
});
|
|
196
211
|
window.addEventListener("message", self._listener);
|
|
197
212
|
return new Injector(self);
|
|
198
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Performs a RPC by sending a message to the Web Request RPC server and
|
|
216
|
+
* awaiting a response.
|
|
217
|
+
*
|
|
218
|
+
* @param qualifiedMethodName the fully-qualified name of the method to call.
|
|
219
|
+
* @param parameters the parameters for the method.
|
|
220
|
+
* @param options the options to use:
|
|
221
|
+
* [timeout] a timeout, in milliseconds, for awaiting a response;
|
|
222
|
+
* a non-positive timeout (<= 0) will cause an indefinite wait.
|
|
223
|
+
*
|
|
224
|
+
* @return a Promise that resolves to the result (or error) of the call.
|
|
225
|
+
*/
|
|
199
226
|
async send(qualifiedMethodName, parameters, {
|
|
200
227
|
timeout = RPC_CLIENT_CALL_TIMEOUT
|
|
201
228
|
}) {
|
|
@@ -235,6 +262,10 @@ var Client = class {
|
|
|
235
262
|
pending.set(message.id, { resolve, reject, cancelTimeout });
|
|
236
263
|
});
|
|
237
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* Disconnects from the remote Web Request RPC server and closes down this
|
|
267
|
+
* client.
|
|
268
|
+
*/
|
|
238
269
|
close() {
|
|
239
270
|
if (this._listener) {
|
|
240
271
|
window.removeEventListener("message", this._listener);
|
|
@@ -246,12 +277,31 @@ var Client = class {
|
|
|
246
277
|
}
|
|
247
278
|
}
|
|
248
279
|
};
|
|
249
|
-
__name(
|
|
250
|
-
var
|
|
280
|
+
__name(_Client, "Client");
|
|
281
|
+
var Client = _Client;
|
|
282
|
+
var _Injector = class _Injector {
|
|
251
283
|
constructor(client) {
|
|
252
284
|
this.client = client;
|
|
253
285
|
this._apis = /* @__PURE__ */ new Map();
|
|
254
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Defines a named API that will use an RPC client to implement its
|
|
289
|
+
* functions. Each of these functions will be asynchronous and return a
|
|
290
|
+
* Promise with the result from the RPC server.
|
|
291
|
+
*
|
|
292
|
+
* This function will return an interface with functions defined according
|
|
293
|
+
* to those provided in the given `definition`. The `name` parameter can be
|
|
294
|
+
* used to obtain this cached interface via `.get(name)`.
|
|
295
|
+
*
|
|
296
|
+
* @param name the name of the API.
|
|
297
|
+
* @param definition the definition for the API, including:
|
|
298
|
+
* functions: an array of function names (as strings) or objects
|
|
299
|
+
* containing: {name: <functionName>, options: <rpcClientOptions>}.
|
|
300
|
+
*
|
|
301
|
+
* @return an interface with the functions provided via `definition` that
|
|
302
|
+
* will make RPC calls to an RPC server to provide their
|
|
303
|
+
* implementation.
|
|
304
|
+
*/
|
|
255
305
|
define(name, definition) {
|
|
256
306
|
if (!(name && typeof name === "string")) {
|
|
257
307
|
throw new TypeError("`name` must be a non-empty string.");
|
|
@@ -278,6 +328,15 @@ var Injector = class {
|
|
|
278
328
|
self._apis[name] = api;
|
|
279
329
|
return api;
|
|
280
330
|
}
|
|
331
|
+
/**
|
|
332
|
+
* Get a named API, defining it if necessary when a definition is provided.
|
|
333
|
+
*
|
|
334
|
+
* @param name the name of the API.
|
|
335
|
+
* @param [definition] the definition for the API; if the API is already
|
|
336
|
+
* defined, this definition is ignored.
|
|
337
|
+
*
|
|
338
|
+
* @return the interface.
|
|
339
|
+
*/
|
|
281
340
|
get(name, definition) {
|
|
282
341
|
const api = this._apis[name];
|
|
283
342
|
if (!api) {
|
|
@@ -289,10 +348,11 @@ var Injector = class {
|
|
|
289
348
|
return this._apis[name];
|
|
290
349
|
}
|
|
291
350
|
};
|
|
292
|
-
__name(
|
|
351
|
+
__name(_Injector, "Injector");
|
|
352
|
+
var Injector = _Injector;
|
|
293
353
|
|
|
294
354
|
// ../../../node_modules/.pnpm/web-request-rpc@2.0.3/node_modules/web-request-rpc/EventEmitter.js
|
|
295
|
-
var
|
|
355
|
+
var _EventEmitter = class _EventEmitter {
|
|
296
356
|
constructor({ deserialize = /* @__PURE__ */ __name((e) => e, "deserialize"), waitUntil = /* @__PURE__ */ __name(async () => {
|
|
297
357
|
}, "waitUntil") } = {}) {
|
|
298
358
|
this._listeners = [];
|
|
@@ -322,15 +382,23 @@ var EventEmitter = class {
|
|
|
322
382
|
}
|
|
323
383
|
}
|
|
324
384
|
};
|
|
325
|
-
__name(
|
|
385
|
+
__name(_EventEmitter, "EventEmitter");
|
|
386
|
+
var EventEmitter = _EventEmitter;
|
|
326
387
|
|
|
327
388
|
// ../../../node_modules/.pnpm/web-request-rpc@2.0.3/node_modules/web-request-rpc/Server.js
|
|
328
|
-
var
|
|
389
|
+
var _Server = class _Server {
|
|
329
390
|
constructor() {
|
|
330
391
|
this.origin = null;
|
|
331
392
|
this._handle = null;
|
|
332
393
|
this._apis = /* @__PURE__ */ new Map();
|
|
333
394
|
}
|
|
395
|
+
/**
|
|
396
|
+
* Provides an implementation for a named API. All functions in the given
|
|
397
|
+
* API will be made callable via RPC clients connected to this server.
|
|
398
|
+
*
|
|
399
|
+
* @param name the name of the API.
|
|
400
|
+
* @param api the API to add.
|
|
401
|
+
*/
|
|
334
402
|
define(name, api) {
|
|
335
403
|
if (!(name && typeof name === "string")) {
|
|
336
404
|
throw new TypeError("`name` must be a non-empty string.");
|
|
@@ -343,6 +411,26 @@ var Server = class {
|
|
|
343
411
|
}
|
|
344
412
|
this._apis[name] = api;
|
|
345
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Listens for RPC messages from clients from a particular origin and
|
|
416
|
+
* window handle and uses them to execute API calls based on predefined
|
|
417
|
+
* APIs.
|
|
418
|
+
*
|
|
419
|
+
* If messages are not from the given origin or window handle, they are
|
|
420
|
+
* ignored. If the messages refer to named APIs that have not been defined
|
|
421
|
+
* then an error message is sent in response. These error messages can
|
|
422
|
+
* be suppressed by using the `ignoreUnknownApi` option.
|
|
423
|
+
*
|
|
424
|
+
* If a message refers to an unknown method on a known named API, then an
|
|
425
|
+
* error message is sent in response.
|
|
426
|
+
*
|
|
427
|
+
* @param origin the origin to listen for.
|
|
428
|
+
* @param options the options to use:
|
|
429
|
+
* [handle] a handle to the window (or a Promise that resolves to
|
|
430
|
+
* a handle) to listen for messages from
|
|
431
|
+
* (defaults to `window.opener || window.parent`).
|
|
432
|
+
* [ignoreUnknownApi] `true` to ignore unknown API messages.
|
|
433
|
+
*/
|
|
346
434
|
async listen(origin, options) {
|
|
347
435
|
if (this._listener) {
|
|
348
436
|
throw new Error("Already listening.");
|
|
@@ -356,7 +444,7 @@ var Server = class {
|
|
|
356
444
|
origin: self.origin,
|
|
357
445
|
handle: self._handle,
|
|
358
446
|
expectRequest: true,
|
|
359
|
-
listener: (message) => {
|
|
447
|
+
listener: /* @__PURE__ */ __name((message) => {
|
|
360
448
|
const { name, method } = destructureMethodName(message.method);
|
|
361
449
|
const api = self._apis[name];
|
|
362
450
|
if (method && method.startsWith("_")) {
|
|
@@ -387,7 +475,7 @@ var Server = class {
|
|
|
387
475
|
}
|
|
388
476
|
}
|
|
389
477
|
})();
|
|
390
|
-
}
|
|
478
|
+
}, "listener")
|
|
391
479
|
});
|
|
392
480
|
window.addEventListener("message", self._listener);
|
|
393
481
|
}
|
|
@@ -398,7 +486,8 @@ var Server = class {
|
|
|
398
486
|
}
|
|
399
487
|
}
|
|
400
488
|
};
|
|
401
|
-
__name(
|
|
489
|
+
__name(_Server, "Server");
|
|
490
|
+
var Server = _Server;
|
|
402
491
|
function sendMethodNotFound(handle, origin, message) {
|
|
403
492
|
const response = {
|
|
404
493
|
jsonrpc: "2.0",
|
|
@@ -414,7 +503,7 @@ function sendMethodNotFound(handle, origin, message) {
|
|
|
414
503
|
__name(sendMethodNotFound, "sendMethodNotFound");
|
|
415
504
|
|
|
416
505
|
// ../../../node_modules/.pnpm/web-request-rpc@2.0.3/node_modules/web-request-rpc/WebApp.js
|
|
417
|
-
var
|
|
506
|
+
var _WebApp = class _WebApp {
|
|
418
507
|
constructor(relyingOrigin) {
|
|
419
508
|
this.relyingOrigin = parseUrl(relyingOrigin).origin;
|
|
420
509
|
this.client = null;
|
|
@@ -424,6 +513,13 @@ var WebApp = class {
|
|
|
424
513
|
this._control = null;
|
|
425
514
|
this._connected = false;
|
|
426
515
|
}
|
|
516
|
+
/**
|
|
517
|
+
* Connects this WebApp to the relying origin that instantiated it. Once
|
|
518
|
+
* connected, the WebApp can start servicing calls from that origin.
|
|
519
|
+
*
|
|
520
|
+
* @return a Promise that resolves to an injector for creating custom client
|
|
521
|
+
* APIs once the connection is ready.
|
|
522
|
+
*/
|
|
427
523
|
async connect() {
|
|
428
524
|
this.injector = await this.client.connect(this.relyingOrigin);
|
|
429
525
|
this._connected = true;
|
|
@@ -433,6 +529,10 @@ var WebApp = class {
|
|
|
433
529
|
this.server.listen(this.relyingOrigin);
|
|
434
530
|
return this.injector;
|
|
435
531
|
}
|
|
532
|
+
/**
|
|
533
|
+
* Must be called after `connect` when this WebApp is ready to start
|
|
534
|
+
* receiving calls from the remote end.
|
|
535
|
+
*/
|
|
436
536
|
async ready() {
|
|
437
537
|
if (!this._connected) {
|
|
438
538
|
throw new Error('WebApp not connected. Did you call ".connect()"?');
|
|
@@ -440,6 +540,9 @@ var WebApp = class {
|
|
|
440
540
|
await this._control.ready();
|
|
441
541
|
return this;
|
|
442
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* Closes this WebApp's connection to the relying origin.
|
|
545
|
+
*/
|
|
443
546
|
close() {
|
|
444
547
|
if (this._connected) {
|
|
445
548
|
this.server.close();
|
|
@@ -447,6 +550,9 @@ var WebApp = class {
|
|
|
447
550
|
this._connected = false;
|
|
448
551
|
}
|
|
449
552
|
}
|
|
553
|
+
/**
|
|
554
|
+
* Shows the UI for this WebApp on the relying origin.
|
|
555
|
+
*/
|
|
450
556
|
async show() {
|
|
451
557
|
if (!this._connected) {
|
|
452
558
|
throw new Error(
|
|
@@ -455,6 +561,9 @@ var WebApp = class {
|
|
|
455
561
|
}
|
|
456
562
|
return this._control.show();
|
|
457
563
|
}
|
|
564
|
+
/**
|
|
565
|
+
* Hides the UI for this WebApp on the relying origin.
|
|
566
|
+
*/
|
|
458
567
|
async hide() {
|
|
459
568
|
if (!this._connected) {
|
|
460
569
|
throw new Error(
|
|
@@ -464,10 +573,11 @@ var WebApp = class {
|
|
|
464
573
|
return this._control.hide();
|
|
465
574
|
}
|
|
466
575
|
};
|
|
467
|
-
__name(
|
|
576
|
+
__name(_WebApp, "WebApp");
|
|
577
|
+
var WebApp = _WebApp;
|
|
468
578
|
|
|
469
579
|
// ../../../node_modules/.pnpm/web-request-rpc@2.0.3/node_modules/web-request-rpc/WebAppWindowDialog.js
|
|
470
|
-
var
|
|
580
|
+
var _WebAppWindowDialog = class _WebAppWindowDialog {
|
|
471
581
|
constructor() {
|
|
472
582
|
this._closeEventListeners = /* @__PURE__ */ new Set();
|
|
473
583
|
}
|
|
@@ -500,10 +610,11 @@ var WebAppWindowDialog = class {
|
|
|
500
610
|
this._closeEventListeners.clear();
|
|
501
611
|
}
|
|
502
612
|
};
|
|
503
|
-
__name(
|
|
613
|
+
__name(_WebAppWindowDialog, "WebAppWindowDialog");
|
|
614
|
+
var WebAppWindowDialog = _WebAppWindowDialog;
|
|
504
615
|
|
|
505
616
|
// ../../../node_modules/.pnpm/web-request-rpc@2.0.3/node_modules/web-request-rpc/WebAppWindowInlineDialog.js
|
|
506
|
-
var
|
|
617
|
+
var _WebAppWindowInlineDialog = class _WebAppWindowInlineDialog extends WebAppWindowDialog {
|
|
507
618
|
constructor({ url, handle, className }) {
|
|
508
619
|
super();
|
|
509
620
|
this.url = url;
|
|
@@ -525,6 +636,7 @@ var WebAppWindowInlineDialog = class extends WebAppWindowDialog {
|
|
|
525
636
|
color: "black",
|
|
526
637
|
"box-sizing": "border-box",
|
|
527
638
|
overflow: "hidden",
|
|
639
|
+
// prevent focus bug in chrome
|
|
528
640
|
"user-select": "none",
|
|
529
641
|
"z-index": 1e6
|
|
530
642
|
});
|
|
@@ -564,6 +676,7 @@ var WebAppWindowInlineDialog = class extends WebAppWindowDialog {
|
|
|
564
676
|
margin: 0,
|
|
565
677
|
padding: 0,
|
|
566
678
|
"flex-grow": 1,
|
|
679
|
+
// prevent focus bug in chrome
|
|
567
680
|
"user-select": "none"
|
|
568
681
|
});
|
|
569
682
|
this.dialog.appendChild(style);
|
|
@@ -608,7 +721,8 @@ var WebAppWindowInlineDialog = class extends WebAppWindowDialog {
|
|
|
608
721
|
super.destroy();
|
|
609
722
|
}
|
|
610
723
|
};
|
|
611
|
-
__name(
|
|
724
|
+
__name(_WebAppWindowInlineDialog, "WebAppWindowInlineDialog");
|
|
725
|
+
var WebAppWindowInlineDialog = _WebAppWindowInlineDialog;
|
|
612
726
|
function applyStyle(element, style) {
|
|
613
727
|
for (const name in style) {
|
|
614
728
|
element.style[name] = style[name];
|
|
@@ -617,7 +731,7 @@ function applyStyle(element, style) {
|
|
|
617
731
|
__name(applyStyle, "applyStyle");
|
|
618
732
|
|
|
619
733
|
// ../../../node_modules/.pnpm/web-request-rpc@2.0.3/node_modules/web-request-rpc/WebAppWindowPopupDialog.js
|
|
620
|
-
var
|
|
734
|
+
var _WebAppWindowPopupDialog = class _WebAppWindowPopupDialog extends WebAppWindowDialog {
|
|
621
735
|
constructor({ url, handle, bounds = { width: 500, height: 400 } }) {
|
|
622
736
|
super();
|
|
623
737
|
this.url = url;
|
|
@@ -693,11 +807,12 @@ var WebAppWindowPopupDialog = class extends WebAppWindowDialog {
|
|
|
693
807
|
};
|
|
694
808
|
}
|
|
695
809
|
};
|
|
696
|
-
__name(
|
|
810
|
+
__name(_WebAppWindowPopupDialog, "WebAppWindowPopupDialog");
|
|
811
|
+
var WebAppWindowPopupDialog = _WebAppWindowPopupDialog;
|
|
697
812
|
|
|
698
813
|
// ../../../node_modules/.pnpm/web-request-rpc@2.0.3/node_modules/web-request-rpc/WebAppWindow.js
|
|
699
814
|
var LOAD_WINDOW_TIMEOUT = 6e4;
|
|
700
|
-
var
|
|
815
|
+
var _WebAppWindow = class _WebAppWindow {
|
|
701
816
|
constructor(url, {
|
|
702
817
|
timeout = LOAD_WINDOW_TIMEOUT,
|
|
703
818
|
dialog = null,
|
|
@@ -705,6 +820,7 @@ var WebAppWindow = class {
|
|
|
705
820
|
popup = false,
|
|
706
821
|
className = null,
|
|
707
822
|
customize = null,
|
|
823
|
+
// top, left, width, height
|
|
708
824
|
bounds
|
|
709
825
|
} = {}) {
|
|
710
826
|
this.visible = false;
|
|
@@ -755,7 +871,7 @@ var WebAppWindow = class {
|
|
|
755
871
|
}
|
|
756
872
|
};
|
|
757
873
|
if (customize) {
|
|
758
|
-
if (
|
|
874
|
+
if (false) {
|
|
759
875
|
throw new TypeError("`options.customize` must be a function.");
|
|
760
876
|
}
|
|
761
877
|
}
|
|
@@ -789,10 +905,16 @@ var WebAppWindow = class {
|
|
|
789
905
|
}
|
|
790
906
|
}
|
|
791
907
|
}
|
|
908
|
+
/**
|
|
909
|
+
* Called by the client when it is ready to receive messages.
|
|
910
|
+
*/
|
|
792
911
|
ready() {
|
|
793
912
|
this._ready = true;
|
|
794
913
|
this._private._resolveReady(true);
|
|
795
914
|
}
|
|
915
|
+
/**
|
|
916
|
+
* Called by the client when it wants to show UI.
|
|
917
|
+
*/
|
|
796
918
|
show() {
|
|
797
919
|
if (!this.visible) {
|
|
798
920
|
this.visible = true;
|
|
@@ -806,6 +928,9 @@ var WebAppWindow = class {
|
|
|
806
928
|
}
|
|
807
929
|
}
|
|
808
930
|
}
|
|
931
|
+
/**
|
|
932
|
+
* Called by the client when it wants to hide UI.
|
|
933
|
+
*/
|
|
809
934
|
hide() {
|
|
810
935
|
if (this.visible) {
|
|
811
936
|
this.visible = false;
|
|
@@ -823,11 +948,12 @@ var WebAppWindow = class {
|
|
|
823
948
|
}
|
|
824
949
|
}
|
|
825
950
|
};
|
|
826
|
-
__name(
|
|
951
|
+
__name(_WebAppWindow, "WebAppWindow");
|
|
952
|
+
var WebAppWindow = _WebAppWindow;
|
|
827
953
|
|
|
828
954
|
// ../../../node_modules/.pnpm/web-request-rpc@2.0.3/node_modules/web-request-rpc/WebAppContext.js
|
|
829
955
|
var WEB_APP_CONTEXT_LOAD_TIMEOUT = 1e4;
|
|
830
|
-
var
|
|
956
|
+
var _WebAppContext = class _WebAppContext {
|
|
831
957
|
constructor() {
|
|
832
958
|
this.client = new Client();
|
|
833
959
|
this.server = new Server();
|
|
@@ -836,6 +962,32 @@ var WebAppContext = class {
|
|
|
836
962
|
this.loaded = false;
|
|
837
963
|
this.closed = false;
|
|
838
964
|
}
|
|
965
|
+
/**
|
|
966
|
+
* Creates a window (or attaches to an existing one) that loads a page that
|
|
967
|
+
* is expected to understand the web request RPC protocol. This method
|
|
968
|
+
* returns a Promise that will resolve once the page uses RPC to indicate
|
|
969
|
+
* that it is ready to be communicated with or once a timeout occurs.
|
|
970
|
+
*
|
|
971
|
+
* The Promise will resolve to an RPC injector that can be used to get or
|
|
972
|
+
* define APIs to enable communication with the WebApp running in the
|
|
973
|
+
* WebAppContext.
|
|
974
|
+
*
|
|
975
|
+
* @param url the URL to the page to connect to.
|
|
976
|
+
* @param options the options to use:
|
|
977
|
+
* [timeout] the timeout for waiting for the client to be ready.
|
|
978
|
+
* [handle] a window handle to connect to; may be a Promise that
|
|
979
|
+
* that resolves to a handle.
|
|
980
|
+
* [iframe] an iframe element to connect to.
|
|
981
|
+
* [windowControl] a window control interface to connect to.
|
|
982
|
+
* [className] a className to assign to the window for CSS purposes.
|
|
983
|
+
* [customize(options)] a function to customize the dialog that
|
|
984
|
+
* loads the window after its construction.
|
|
985
|
+
* [bounds] a bounding rectangle (top, left, width, height) to
|
|
986
|
+
* use when creating a popup window.
|
|
987
|
+
*
|
|
988
|
+
* @return a Promise that resolves to an RPC injector once the window is
|
|
989
|
+
* ready.
|
|
990
|
+
*/
|
|
839
991
|
async createWindow(url, {
|
|
840
992
|
timeout = WEB_APP_CONTEXT_LOAD_TIMEOUT,
|
|
841
993
|
iframe,
|
|
@@ -845,6 +997,7 @@ var WebAppContext = class {
|
|
|
845
997
|
windowControl,
|
|
846
998
|
className,
|
|
847
999
|
customize,
|
|
1000
|
+
// top, left, width, height
|
|
848
1001
|
bounds
|
|
849
1002
|
} = {}) {
|
|
850
1003
|
if (this.loaded) {
|
|
@@ -884,10 +1037,11 @@ var WebAppContext = class {
|
|
|
884
1037
|
}
|
|
885
1038
|
}
|
|
886
1039
|
};
|
|
887
|
-
__name(
|
|
1040
|
+
__name(_WebAppContext, "WebAppContext");
|
|
1041
|
+
var WebAppContext = _WebAppContext;
|
|
888
1042
|
|
|
889
1043
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/CredentialRequestEvent.js
|
|
890
|
-
var
|
|
1044
|
+
var _CredentialRequestEvent = class _CredentialRequestEvent {
|
|
891
1045
|
constructor({
|
|
892
1046
|
credentialHandler,
|
|
893
1047
|
credentialRequestOrigin,
|
|
@@ -914,10 +1068,11 @@ var CredentialRequestEvent = class {
|
|
|
914
1068
|
this._promise = handlerResponse;
|
|
915
1069
|
}
|
|
916
1070
|
};
|
|
917
|
-
__name(
|
|
1071
|
+
__name(_CredentialRequestEvent, "CredentialRequestEvent");
|
|
1072
|
+
var CredentialRequestEvent = _CredentialRequestEvent;
|
|
918
1073
|
|
|
919
1074
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/CredentialStoreEvent.js
|
|
920
|
-
var
|
|
1075
|
+
var _CredentialStoreEvent = class _CredentialStoreEvent {
|
|
921
1076
|
constructor({
|
|
922
1077
|
credentialHandler,
|
|
923
1078
|
credentialRequestOrigin,
|
|
@@ -942,10 +1097,11 @@ var CredentialStoreEvent = class {
|
|
|
942
1097
|
this._promise = handlerResponse;
|
|
943
1098
|
}
|
|
944
1099
|
};
|
|
945
|
-
__name(
|
|
1100
|
+
__name(_CredentialStoreEvent, "CredentialStoreEvent");
|
|
1101
|
+
var CredentialStoreEvent = _CredentialStoreEvent;
|
|
946
1102
|
|
|
947
1103
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/CredentialHandlerService.js
|
|
948
|
-
var
|
|
1104
|
+
var _CredentialHandlerService = class _CredentialHandlerService {
|
|
949
1105
|
constructor(credentialHandler) {
|
|
950
1106
|
this._credentialHandler = credentialHandler;
|
|
951
1107
|
}
|
|
@@ -966,11 +1122,12 @@ var CredentialHandlerService = class {
|
|
|
966
1122
|
);
|
|
967
1123
|
}
|
|
968
1124
|
};
|
|
969
|
-
__name(
|
|
1125
|
+
__name(_CredentialHandlerService, "CredentialHandlerService");
|
|
1126
|
+
var CredentialHandlerService = _CredentialHandlerService;
|
|
970
1127
|
|
|
971
1128
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/CredentialHandler.js
|
|
972
1129
|
var EVENT_TYPES = ["credentialrequest", "credentialstore"];
|
|
973
|
-
var
|
|
1130
|
+
var _CredentialHandler = class _CredentialHandler extends WebApp {
|
|
974
1131
|
constructor(mediatorOrigin, inline = false) {
|
|
975
1132
|
if (typeof mediatorOrigin !== "string") {
|
|
976
1133
|
throw new TypeError('"mediatorOrigin" must be a string.');
|
|
@@ -1012,10 +1169,11 @@ var CredentialHandler = class extends WebApp {
|
|
|
1012
1169
|
return this._emitter.removeEventListener(eventType, fn);
|
|
1013
1170
|
}
|
|
1014
1171
|
};
|
|
1015
|
-
__name(
|
|
1172
|
+
__name(_CredentialHandler, "CredentialHandler");
|
|
1173
|
+
var CredentialHandler = _CredentialHandler;
|
|
1016
1174
|
|
|
1017
1175
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/CredentialHints.js
|
|
1018
|
-
var
|
|
1176
|
+
var _CredentialHints = class _CredentialHints {
|
|
1019
1177
|
constructor(url, injector) {
|
|
1020
1178
|
const remote = injector.get("credentialHints", {
|
|
1021
1179
|
functions: ["delete", "get", "keys", "has", "set", "clear"]
|
|
@@ -1044,7 +1202,8 @@ var CredentialHints = class {
|
|
|
1044
1202
|
console.warn("Credential hints are deprecated and no longer used.");
|
|
1045
1203
|
}
|
|
1046
1204
|
};
|
|
1047
|
-
__name(
|
|
1205
|
+
__name(_CredentialHints, "CredentialHints");
|
|
1206
|
+
var CredentialHints = _CredentialHints;
|
|
1048
1207
|
function imageToDataUrl(url) {
|
|
1049
1208
|
return new Promise((resolve) => {
|
|
1050
1209
|
const img = new Image();
|
|
@@ -1066,13 +1225,20 @@ function imageToDataUrl(url) {
|
|
|
1066
1225
|
__name(imageToDataUrl, "imageToDataUrl");
|
|
1067
1226
|
|
|
1068
1227
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/CredentialManager.js
|
|
1069
|
-
var
|
|
1228
|
+
var _CredentialManager = class _CredentialManager {
|
|
1070
1229
|
constructor(url, injector) {
|
|
1071
1230
|
if (!(url && typeof url === "string")) {
|
|
1072
1231
|
throw new TypeError('"url" must be a non-empty string.');
|
|
1073
1232
|
}
|
|
1074
1233
|
this.hints = new CredentialHints(url, injector);
|
|
1075
1234
|
}
|
|
1235
|
+
/**
|
|
1236
|
+
* Requests that the user grant 'credentialhandler' permission to the current
|
|
1237
|
+
* origin.
|
|
1238
|
+
*
|
|
1239
|
+
* @return a Promise that resolves to the new PermissionState of the
|
|
1240
|
+
* permission (e.g. 'granted'/'denied').
|
|
1241
|
+
*/
|
|
1076
1242
|
static async requestPermission() {
|
|
1077
1243
|
const status = await navigator.credentialsPolyfill.permissions.request(
|
|
1078
1244
|
{ name: "credentialhandler" }
|
|
@@ -1080,10 +1246,11 @@ var CredentialManager = class {
|
|
|
1080
1246
|
return status.state;
|
|
1081
1247
|
}
|
|
1082
1248
|
};
|
|
1083
|
-
__name(
|
|
1249
|
+
__name(_CredentialManager, "CredentialManager");
|
|
1250
|
+
var CredentialManager = _CredentialManager;
|
|
1084
1251
|
|
|
1085
1252
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/CredentialHandlerRegistration.js
|
|
1086
|
-
var
|
|
1253
|
+
var _CredentialHandlerRegistration = class _CredentialHandlerRegistration {
|
|
1087
1254
|
constructor(url, injector) {
|
|
1088
1255
|
if (!(url && typeof url === "string")) {
|
|
1089
1256
|
throw new TypeError('"url" must be a non-empty string.');
|
|
@@ -1091,10 +1258,11 @@ var CredentialHandlerRegistration = class {
|
|
|
1091
1258
|
this.credentialManager = new CredentialManager(url, injector);
|
|
1092
1259
|
}
|
|
1093
1260
|
};
|
|
1094
|
-
__name(
|
|
1261
|
+
__name(_CredentialHandlerRegistration, "CredentialHandlerRegistration");
|
|
1262
|
+
var CredentialHandlerRegistration = _CredentialHandlerRegistration;
|
|
1095
1263
|
|
|
1096
1264
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/CredentialHandlers.js
|
|
1097
|
-
var
|
|
1265
|
+
var _CredentialHandlers = class _CredentialHandlers {
|
|
1098
1266
|
constructor(injector) {
|
|
1099
1267
|
this._init = (async () => {
|
|
1100
1268
|
this._injector = await injector;
|
|
@@ -1108,17 +1276,40 @@ var CredentialHandlers = class {
|
|
|
1108
1276
|
});
|
|
1109
1277
|
})();
|
|
1110
1278
|
}
|
|
1279
|
+
/**
|
|
1280
|
+
* Creates a credential handler registration.
|
|
1281
|
+
*
|
|
1282
|
+
* @param url the unique URL for the credential handler.
|
|
1283
|
+
*
|
|
1284
|
+
* @return a Promise that resolves to the CredentialHandlerRegistration.
|
|
1285
|
+
*/
|
|
1111
1286
|
async register(url) {
|
|
1112
1287
|
this._deprecateNotice();
|
|
1113
1288
|
await this._init;
|
|
1114
1289
|
url = await this._remote.register("credential", url);
|
|
1115
1290
|
return new CredentialHandlerRegistration(url, this._injector);
|
|
1116
1291
|
}
|
|
1292
|
+
/**
|
|
1293
|
+
* Unregisters a credential handler, destroying its registration.
|
|
1294
|
+
*
|
|
1295
|
+
* @param url the unique URL for the credential handler.
|
|
1296
|
+
*
|
|
1297
|
+
* @return a Promise that resolves to `true` if the handler was registered
|
|
1298
|
+
* and `false` if not.
|
|
1299
|
+
*/
|
|
1117
1300
|
async unregister(url) {
|
|
1118
1301
|
this._deprecateNotice();
|
|
1119
1302
|
await this._init;
|
|
1120
1303
|
return this._remote.unregister("credential", url);
|
|
1121
1304
|
}
|
|
1305
|
+
/**
|
|
1306
|
+
* Gets an existing credential handler registration.
|
|
1307
|
+
*
|
|
1308
|
+
* @param url the URL for the credential handler.
|
|
1309
|
+
*
|
|
1310
|
+
* @return a Promise that resolves to the CredentialHandlerRegistration or
|
|
1311
|
+
* `null` if no such registration exists.
|
|
1312
|
+
*/
|
|
1122
1313
|
async getRegistration(url) {
|
|
1123
1314
|
this._deprecateNotice();
|
|
1124
1315
|
await this._init;
|
|
@@ -1128,6 +1319,15 @@ var CredentialHandlers = class {
|
|
|
1128
1319
|
}
|
|
1129
1320
|
return new CredentialHandlerRegistration(url, this._injector);
|
|
1130
1321
|
}
|
|
1322
|
+
/**
|
|
1323
|
+
* Returns true if the given credential handler has been registered and
|
|
1324
|
+
* false if not.
|
|
1325
|
+
*
|
|
1326
|
+
* @param url the URL for the credential handler.
|
|
1327
|
+
*
|
|
1328
|
+
* @return a Promise that resolves to `true` if the registration exists and
|
|
1329
|
+
* `false` if not.
|
|
1330
|
+
*/
|
|
1131
1331
|
async hasRegistration(url) {
|
|
1132
1332
|
this._deprecateNotice();
|
|
1133
1333
|
await this._init;
|
|
@@ -1139,10 +1339,11 @@ var CredentialHandlers = class {
|
|
|
1139
1339
|
);
|
|
1140
1340
|
}
|
|
1141
1341
|
};
|
|
1142
|
-
__name(
|
|
1342
|
+
__name(_CredentialHandlers, "CredentialHandlers");
|
|
1343
|
+
var CredentialHandlers = _CredentialHandlers;
|
|
1143
1344
|
|
|
1144
1345
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/WebCredential.js
|
|
1145
|
-
var
|
|
1346
|
+
var _WebCredential = class _WebCredential {
|
|
1146
1347
|
constructor(dataType, data, {
|
|
1147
1348
|
recommendedHandlerOrigins = [],
|
|
1148
1349
|
protocols = {}
|
|
@@ -1156,12 +1357,13 @@ var WebCredential2 = class {
|
|
|
1156
1357
|
this.options = { recommendedHandlerOrigins, protocols };
|
|
1157
1358
|
}
|
|
1158
1359
|
};
|
|
1159
|
-
__name(
|
|
1360
|
+
__name(_WebCredential, "WebCredential");
|
|
1361
|
+
var WebCredential2 = _WebCredential;
|
|
1160
1362
|
|
|
1161
1363
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/CredentialsContainer.js
|
|
1162
1364
|
var CREDENTIAL_GET_TIMEOUT = 0;
|
|
1163
1365
|
var CREDENTIAL_STORE_TIMEOUT = 0;
|
|
1164
|
-
var
|
|
1366
|
+
var _CredentialsContainer = class _CredentialsContainer {
|
|
1165
1367
|
constructor(injector) {
|
|
1166
1368
|
this._nativeCredentialsContainer = {
|
|
1167
1369
|
get: navigator.credentials && navigator.credentials.get && navigator.credentials.get.bind(navigator.credentials),
|
|
@@ -1205,11 +1407,12 @@ var CredentialsContainer = class {
|
|
|
1205
1407
|
throw new DOMException("Not implemented.", "NotSupportedError");
|
|
1206
1408
|
}
|
|
1207
1409
|
};
|
|
1208
|
-
__name(
|
|
1410
|
+
__name(_CredentialsContainer, "CredentialsContainer");
|
|
1411
|
+
var CredentialsContainer = _CredentialsContainer;
|
|
1209
1412
|
|
|
1210
1413
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/PermissionManager.js
|
|
1211
1414
|
var PERMISSION_REQUEST_TIMEOUT = 0;
|
|
1212
|
-
var
|
|
1415
|
+
var _PermissionManager = class _PermissionManager {
|
|
1213
1416
|
constructor(injector) {
|
|
1214
1417
|
this._init = (async () => {
|
|
1215
1418
|
this._remote = (await injector).get("permissionManager", {
|
|
@@ -1234,7 +1437,8 @@ var PermissionManager = class {
|
|
|
1234
1437
|
return await this._remote.revoke(permissionDesc);
|
|
1235
1438
|
}
|
|
1236
1439
|
};
|
|
1237
|
-
__name(
|
|
1440
|
+
__name(_PermissionManager, "PermissionManager");
|
|
1441
|
+
var PermissionManager = _PermissionManager;
|
|
1238
1442
|
|
|
1239
1443
|
// ../../../node_modules/.pnpm/credential-handler-polyfill@3.2.1/node_modules/credential-handler-polyfill/index.js
|
|
1240
1444
|
var DEFAULT_MEDIATOR_ORIGIN = "https://authn.io";
|
|
@@ -1264,6 +1468,7 @@ async function load(options = {
|
|
|
1264
1468
|
const appContext = new WebAppContext();
|
|
1265
1469
|
const injector = appContext.createWindow(mediatorUrl, {
|
|
1266
1470
|
className: "credential-mediator",
|
|
1471
|
+
// 30 second timeout for loading the mediator
|
|
1267
1472
|
timeout: 3e4
|
|
1268
1473
|
});
|
|
1269
1474
|
const style = document.createElement("style");
|
|
@@ -1319,7 +1524,7 @@ __name(_assertSecureContext, "_assertSecureContext");
|
|
|
1319
1524
|
|
|
1320
1525
|
// ../../../node_modules/.pnpm/web-credential-handler@2.0.2/node_modules/web-credential-handler/CredentialEventProxy.js
|
|
1321
1526
|
var PROXY_EVENT_TIMEOUT = 6e4;
|
|
1322
|
-
var
|
|
1527
|
+
var _CredentialEventProxy = class _CredentialEventProxy extends WebApp {
|
|
1323
1528
|
constructor() {
|
|
1324
1529
|
super(window.location.origin);
|
|
1325
1530
|
}
|
|
@@ -1331,6 +1536,7 @@ var CredentialEventProxy = class extends WebApp {
|
|
|
1331
1536
|
rejectReceive(new Error("Timed out waiting to receive event."));
|
|
1332
1537
|
}, PROXY_EVENT_TIMEOUT);
|
|
1333
1538
|
self.server.define("credentialEventProxy", {
|
|
1539
|
+
// called by credential handler to send event to UI window
|
|
1334
1540
|
async send(event) {
|
|
1335
1541
|
resolveReceive(event);
|
|
1336
1542
|
clearTimeout(timeoutId);
|
|
@@ -1349,7 +1555,8 @@ var CredentialEventProxy = class extends WebApp {
|
|
|
1349
1555
|
});
|
|
1350
1556
|
}
|
|
1351
1557
|
};
|
|
1352
|
-
__name(
|
|
1558
|
+
__name(_CredentialEventProxy, "CredentialEventProxy");
|
|
1559
|
+
var CredentialEventProxy = _CredentialEventProxy;
|
|
1353
1560
|
|
|
1354
1561
|
// ../../../node_modules/.pnpm/web-credential-handler@2.0.2/node_modules/web-credential-handler/index.js
|
|
1355
1562
|
var DEFAULT_MEDIATOR = "https://authn.io";
|
|
@@ -1411,6 +1618,8 @@ async function createResponse({ event, get, store }) {
|
|
|
1411
1618
|
const windowReady = appContext.createWindow(result.url, {
|
|
1412
1619
|
handle,
|
|
1413
1620
|
popup: false,
|
|
1621
|
+
// default to 10 minute timeout for loading other window on same site
|
|
1622
|
+
// to allow for authentication pages and similar
|
|
1414
1623
|
timeout: 6e5
|
|
1415
1624
|
});
|
|
1416
1625
|
const injector = await windowReady;
|
|
@@ -1437,21 +1646,21 @@ var getCHAPIPlugin = /* @__PURE__ */ __name(async () => {
|
|
|
1437
1646
|
return {
|
|
1438
1647
|
name: "CHAPI",
|
|
1439
1648
|
methods: {
|
|
1440
|
-
installChapiHandler: async () => {
|
|
1649
|
+
installChapiHandler: /* @__PURE__ */ __name(async () => {
|
|
1441
1650
|
throw new Error("CHAPI is only available inside of a browser!");
|
|
1442
|
-
},
|
|
1443
|
-
activateChapiHandler: async () => {
|
|
1651
|
+
}, "installChapiHandler"),
|
|
1652
|
+
activateChapiHandler: /* @__PURE__ */ __name(async () => {
|
|
1444
1653
|
throw new Error("CHAPI is only available inside of a browser!");
|
|
1445
|
-
},
|
|
1446
|
-
receiveChapiEvent: async () => {
|
|
1654
|
+
}, "activateChapiHandler"),
|
|
1655
|
+
receiveChapiEvent: /* @__PURE__ */ __name(async () => {
|
|
1447
1656
|
throw new Error("CHAPI is only available inside of a browser!");
|
|
1448
|
-
},
|
|
1449
|
-
storeCredentialViaChapiDidAuth: async () => {
|
|
1657
|
+
}, "receiveChapiEvent"),
|
|
1658
|
+
storeCredentialViaChapiDidAuth: /* @__PURE__ */ __name(async () => {
|
|
1450
1659
|
throw new Error("CHAPI is only available inside of a browser!");
|
|
1451
|
-
},
|
|
1452
|
-
storePresentationViaChapi: async () => {
|
|
1660
|
+
}, "storeCredentialViaChapiDidAuth"),
|
|
1661
|
+
storePresentationViaChapi: /* @__PURE__ */ __name(async () => {
|
|
1453
1662
|
throw new Error("CHAPI is only available inside of a browser!");
|
|
1454
|
-
}
|
|
1663
|
+
}, "storePresentationViaChapi")
|
|
1455
1664
|
}
|
|
1456
1665
|
};
|
|
1457
1666
|
}
|
|
@@ -1465,8 +1674,8 @@ var getCHAPIPlugin = /* @__PURE__ */ __name(async () => {
|
|
|
1465
1674
|
displayName: "CHAPI",
|
|
1466
1675
|
description: "Credential Handler API. Allows sending/retrieving credentials across wallets and issuers",
|
|
1467
1676
|
methods: {
|
|
1468
|
-
installChapiHandler: async () => installHandler(),
|
|
1469
|
-
activateChapiHandler: async (_learnCard, {
|
|
1677
|
+
installChapiHandler: /* @__PURE__ */ __name(async () => installHandler(), "installChapiHandler"),
|
|
1678
|
+
activateChapiHandler: /* @__PURE__ */ __name(async (_learnCard, {
|
|
1470
1679
|
mediatorOrigin = `https://authn.io/mediator?${encodeURIComponent(
|
|
1471
1680
|
window.location.origin
|
|
1472
1681
|
)}`,
|
|
@@ -1474,9 +1683,9 @@ var getCHAPIPlugin = /* @__PURE__ */ __name(async () => {
|
|
|
1474
1683
|
store
|
|
1475
1684
|
}) => {
|
|
1476
1685
|
return activateHandler({ mediatorOrigin, get, store });
|
|
1477
|
-
},
|
|
1478
|
-
receiveChapiEvent: async () => receiveCredentialEvent(),
|
|
1479
|
-
storeCredentialViaChapiDidAuth: async (_learnCard, credential) => {
|
|
1686
|
+
}, "activateChapiHandler"),
|
|
1687
|
+
receiveChapiEvent: /* @__PURE__ */ __name(async () => receiveCredentialEvent(), "receiveChapiEvent"),
|
|
1688
|
+
storeCredentialViaChapiDidAuth: /* @__PURE__ */ __name(async (_learnCard, credential) => {
|
|
1480
1689
|
const challenge = crypto.randomUUID();
|
|
1481
1690
|
const domain = window.location.origin;
|
|
1482
1691
|
const vpr = {
|
|
@@ -1489,8 +1698,7 @@ var getCHAPIPlugin = /* @__PURE__ */ __name(async () => {
|
|
|
1489
1698
|
}
|
|
1490
1699
|
};
|
|
1491
1700
|
const res = await navigator.credentials.get(vpr);
|
|
1492
|
-
if (!res)
|
|
1493
|
-
return { success: false, reason: "did not auth" };
|
|
1701
|
+
if (!res) return { success: false, reason: "did not auth" };
|
|
1494
1702
|
const verification = await _learnCard.invoke.verifyPresentation(res.data, {
|
|
1495
1703
|
challenge,
|
|
1496
1704
|
domain,
|
|
@@ -1518,92 +1726,135 @@ var getCHAPIPlugin = /* @__PURE__ */ __name(async () => {
|
|
|
1518
1726
|
const vp = await _learnCard.invoke.getTestVp();
|
|
1519
1727
|
vp.verifiableCredential = issuedCredentials;
|
|
1520
1728
|
const success = await _learnCard.invoke.storePresentationViaChapi(vp);
|
|
1521
|
-
if (success)
|
|
1522
|
-
return { success: true };
|
|
1729
|
+
if (success) return { success: true };
|
|
1523
1730
|
return { success: false, reason: "did not store" };
|
|
1524
|
-
},
|
|
1525
|
-
storePresentationViaChapi: async (_learnCard, presentation) => {
|
|
1731
|
+
}, "storeCredentialViaChapiDidAuth"),
|
|
1732
|
+
storePresentationViaChapi: /* @__PURE__ */ __name(async (_learnCard, presentation) => {
|
|
1526
1733
|
const wc = new WebCredential("VerifiablePresentation", presentation);
|
|
1527
1734
|
return window.navigator.credentials.store(wc);
|
|
1528
|
-
}
|
|
1735
|
+
}, "storePresentationViaChapi")
|
|
1529
1736
|
}
|
|
1530
1737
|
};
|
|
1531
1738
|
}, "getCHAPIPlugin");
|
|
1532
1739
|
export {
|
|
1533
1740
|
getCHAPIPlugin
|
|
1534
1741
|
};
|
|
1535
|
-
/*!
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1742
|
+
/*! Bundled license information:
|
|
1743
|
+
|
|
1744
|
+
web-request-rpc/utils.js:
|
|
1745
|
+
(*!
|
|
1746
|
+
* Utilities for Web Request RPC.
|
|
1747
|
+
*
|
|
1748
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
|
1749
|
+
*)
|
|
1750
|
+
|
|
1751
|
+
web-request-rpc/Client.js:
|
|
1752
|
+
web-request-rpc/EventEmitter.js:
|
|
1753
|
+
web-request-rpc/Server.js:
|
|
1754
|
+
(*!
|
|
1755
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
|
1756
|
+
*)
|
|
1757
|
+
|
|
1758
|
+
web-request-rpc/WebApp.js:
|
|
1759
|
+
(*!
|
|
1760
|
+
* A WebApp is a remote application that runs in a WebAppContext.
|
|
1761
|
+
*
|
|
1762
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
|
1763
|
+
*)
|
|
1764
|
+
|
|
1765
|
+
web-request-rpc/WebAppWindowDialog.js:
|
|
1766
|
+
web-request-rpc/WebAppWindowInlineDialog.js:
|
|
1767
|
+
(*!
|
|
1768
|
+
* Copyright (c) 2022 Digital Bazaar, Inc. All rights reserved.
|
|
1769
|
+
*)
|
|
1770
|
+
|
|
1771
|
+
web-request-rpc/WebAppWindowPopupDialog.js:
|
|
1772
|
+
(*!
|
|
1773
|
+
* Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
|
|
1774
|
+
*)
|
|
1775
|
+
|
|
1776
|
+
web-request-rpc/WebAppWindow.js:
|
|
1777
|
+
(*!
|
|
1778
|
+
* Copyright (c) 2017-2023 Digital Bazaar, Inc. All rights reserved.
|
|
1779
|
+
*)
|
|
1780
|
+
|
|
1781
|
+
web-request-rpc/WebAppContext.js:
|
|
1782
|
+
credential-handler-polyfill/CredentialHandlerService.js:
|
|
1783
|
+
credential-handler-polyfill/CredentialHints.js:
|
|
1784
|
+
credential-handler-polyfill/CredentialManager.js:
|
|
1785
|
+
credential-handler-polyfill/CredentialHandlers.js:
|
|
1786
|
+
credential-handler-polyfill/PermissionManager.js:
|
|
1787
|
+
(*!
|
|
1788
|
+
* Copyright (c) 2017-2022 Digital Bazaar, Inc. All rights reserved.
|
|
1789
|
+
*)
|
|
1790
|
+
|
|
1791
|
+
web-request-rpc/index.js:
|
|
1792
|
+
(*!
|
|
1793
|
+
* JSON-RPC for Web Request Polyfills.
|
|
1794
|
+
*
|
|
1795
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
|
1796
|
+
*)
|
|
1797
|
+
|
|
1798
|
+
credential-handler-polyfill/CredentialRequestEvent.js:
|
|
1799
|
+
(*!
|
|
1800
|
+
* A CredentialRequestEvent is emitted when a request has been made for
|
|
1801
|
+
* credentials.
|
|
1802
|
+
*
|
|
1803
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
|
1804
|
+
*)
|
|
1805
|
+
|
|
1806
|
+
credential-handler-polyfill/CredentialStoreEvent.js:
|
|
1807
|
+
(*!
|
|
1808
|
+
* A CredentialStoreEvent is emitted when a request has been made to
|
|
1809
|
+
* store a credential.
|
|
1810
|
+
*
|
|
1811
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
|
1812
|
+
*)
|
|
1813
|
+
|
|
1814
|
+
credential-handler-polyfill/CredentialHandler.js:
|
|
1815
|
+
(*!
|
|
1816
|
+
* The core CredentialHandler class.
|
|
1817
|
+
*
|
|
1818
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
|
1819
|
+
*)
|
|
1820
|
+
|
|
1821
|
+
credential-handler-polyfill/CredentialHandlerRegistration.js:
|
|
1822
|
+
(*!
|
|
1823
|
+
* A CredentialHandlerRegistration provides a CredentialManager to enable Web
|
|
1824
|
+
* apps to register Profiles that can be presented to websites.
|
|
1825
|
+
*
|
|
1826
|
+
* Copyright (c) 2017 Digital Bazaar, Inc. All rights reserved.
|
|
1827
|
+
*)
|
|
1828
|
+
|
|
1829
|
+
credential-handler-polyfill/WebCredential.js:
|
|
1830
|
+
(*!
|
|
1831
|
+
* A WebCredential is a Credential that can be retrieved from or stored by a
|
|
1832
|
+
* "credential handler" that runs in a third party Web application.
|
|
1833
|
+
*
|
|
1834
|
+
* Copyright (c) 2017-2023 Digital Bazaar, Inc. All rights reserved.
|
|
1835
|
+
*)
|
|
1836
|
+
|
|
1837
|
+
credential-handler-polyfill/CredentialsContainer.js:
|
|
1838
|
+
(*!
|
|
1839
|
+
* Wrapper for native CredentialsContainer that uses remote Credential Mediator
|
|
1840
|
+
* for WebCredential-related operations.
|
|
1841
|
+
*
|
|
1842
|
+
* Copyright (c) 2017-2018 Digital Bazaar, Inc. All rights reserved.
|
|
1843
|
+
*)
|
|
1844
|
+
|
|
1845
|
+
credential-handler-polyfill/index.js:
|
|
1846
|
+
(*!
|
|
1847
|
+
* Copyright (c) 2017-2024 Digital Bazaar, Inc. All rights reserved.
|
|
1848
|
+
*)
|
|
1849
|
+
|
|
1850
|
+
web-credential-handler/CredentialEventProxy.js:
|
|
1851
|
+
(*!
|
|
1852
|
+
* Copyright (c) 2017-2018 Digital Bazaar, Inc. All rights reserved.
|
|
1853
|
+
*)
|
|
1854
|
+
|
|
1855
|
+
web-credential-handler/index.js:
|
|
1856
|
+
(*!
|
|
1857
|
+
* Copyright (c) 2018-2022 Digital Bazaar, Inc. All rights reserved.
|
|
1858
|
+
*)
|
|
1859
|
+
*/
|
|
1609
1860
|
//# sourceMappingURL=chapi-plugin.esm.js.map
|