@openkey/sdk 0.10.1 → 0.11.0
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.d.mts +32 -15
- package/dist/index.d.ts +32 -15
- package/dist/index.js +39 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +38 -35
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -27,7 +27,8 @@ interface NostrError {
|
|
|
27
27
|
*/
|
|
28
28
|
declare class OpenKeyNostr {
|
|
29
29
|
private host;
|
|
30
|
-
|
|
30
|
+
private passkeysSupported;
|
|
31
|
+
constructor(host: string, passkeysSupported?: boolean);
|
|
31
32
|
/**
|
|
32
33
|
* Get-or-create the user's OpenKey-custodied Nostr identity. Always shows
|
|
33
34
|
* a visible consent card (identity creation, or - when `relayUrl` is
|
|
@@ -67,7 +68,19 @@ interface OpenKeyConfig {
|
|
|
67
68
|
mode?: OpenKeyMode;
|
|
68
69
|
/** App-provided wallet provider for external key signing */
|
|
69
70
|
externalProvider?: EIP1193Provider;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the client can use passkeys (WebAuthn). Default: true. Pass
|
|
73
|
+
* false from clients where WebAuthn does not work (for example an
|
|
74
|
+
* ad-hoc-signed desktop webview); the OpenKey UI then offers only email
|
|
75
|
+
* and social sign-in.
|
|
76
|
+
*/
|
|
77
|
+
passkeysSupported?: boolean;
|
|
70
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Query suffix telling the OpenKey widget that passkeys are unavailable.
|
|
81
|
+
* Empty when passkeys are supported, so default URLs are unchanged.
|
|
82
|
+
*/
|
|
83
|
+
declare function passkeysQueryFlag(passkeysSupported: boolean): string;
|
|
71
84
|
interface SignMessageRequest {
|
|
72
85
|
message: string;
|
|
73
86
|
keyId?: string;
|
|
@@ -325,18 +338,18 @@ declare class OpenKey {
|
|
|
325
338
|
private oauthHost;
|
|
326
339
|
private appName;
|
|
327
340
|
private mode;
|
|
341
|
+
private passkeysSupported;
|
|
328
342
|
private config;
|
|
329
343
|
private popup;
|
|
330
344
|
private lastAuth;
|
|
331
345
|
private discoveredProviders;
|
|
332
|
-
private sessionToken;
|
|
333
346
|
/** Cancels widget flows that could outlive a sign-out on this instance. */
|
|
334
347
|
private activeFlowCancellations;
|
|
335
348
|
/**
|
|
336
349
|
* Nostr identity custody + signing (secp256k1 Schnorr / BIP-340). Kept
|
|
337
350
|
* fully separate from the Ethereum flows above: it never reuses
|
|
338
|
-
* `lastAuth
|
|
339
|
-
*
|
|
351
|
+
* `lastAuth`, and its widget messages never carry a session token -
|
|
352
|
+
* the OpenKey session and any signing grants stay inside
|
|
340
353
|
* the OpenKey-origin iframe for the whole lifetime of this client.
|
|
341
354
|
*/
|
|
342
355
|
readonly nostr: OpenKeyNostr;
|
|
@@ -371,24 +384,28 @@ declare class OpenKey {
|
|
|
371
384
|
/**
|
|
372
385
|
* Signs the active OpenKey account out through the OpenKey-owned widget.
|
|
373
386
|
*
|
|
374
|
-
* The
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
387
|
+
* The OpenKey-owned widget revokes the OpenKey session it holds itself;
|
|
388
|
+
* the SDK never holds an OpenKey session token. Local SDK state is cleared
|
|
389
|
+
* before opening the widget, including when remote revocation is
|
|
390
|
+
* unavailable.
|
|
378
391
|
*/
|
|
379
392
|
signOut(opts?: {
|
|
380
393
|
mode?: OpenKeyMode;
|
|
381
394
|
}): Promise<SignOutAcknowledgement>;
|
|
382
395
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
396
|
+
* Always null. OpenKey no longer gives its session token to the embedding
|
|
397
|
+
* page (TC-688): the token unlocked OpenKey's key and account APIs, not
|
|
398
|
+
* just the requesting app's flows.
|
|
399
|
+
*
|
|
400
|
+
* @deprecated Kept so existing callers compile. Third-party server-side
|
|
401
|
+
* signing uses an OAuth access token from the OpenKey OAuth flow.
|
|
386
402
|
*/
|
|
387
403
|
getSessionToken(): string | null;
|
|
388
404
|
/**
|
|
389
|
-
* Endpoint
|
|
390
|
-
*
|
|
391
|
-
*
|
|
405
|
+
* Endpoint for a TinyCloud auto-sign signing strategy. `token` is always
|
|
406
|
+
* null; see {@link OpenKey.getSessionToken}.
|
|
407
|
+
*
|
|
408
|
+
* @deprecated The endpoint accepts an OAuth access token as its bearer.
|
|
392
409
|
*/
|
|
393
410
|
tinycloudSigningOptions(): {
|
|
394
411
|
endpoint: string;
|
|
@@ -551,4 +568,4 @@ declare class OpenKeyProvider implements EIP1193Provider {
|
|
|
551
568
|
|
|
552
569
|
declare function getOpenKey(config?: OpenKeyConfig): OpenKey;
|
|
553
570
|
|
|
554
|
-
export { type AuthResult, type AuthorizeTinyCloudRouting, type CapabilityPresentationEnvelopeV1, type EIP1193Provider, KeyIdTypeMismatchError, type NostrError, type NostrIdentity, type OAuthConfig, type OAuthResult, type OAuthTokenResponse, OpenKey, type OpenKeyConfig, type OpenKeyError, type OpenKeyMode, OpenKeyNostr, OpenKeyProvider, type SignMessageRequest, type SignOutAcknowledgement, type SignResult, type SignTypedDataRequest, type SignedNostrEvent, type TinyCloudAuthorizationRequestV1, type TinyCloudAuthorizationResultV1, type UnsignedNostrEvent, OpenKey as default, getOpenKey, resolveAuthorizeTinyCloudRouting, shouldRouteAuthorizeTinyCloudExternal, validateIframeResize };
|
|
571
|
+
export { type AuthResult, type AuthorizeTinyCloudRouting, type CapabilityPresentationEnvelopeV1, type EIP1193Provider, KeyIdTypeMismatchError, type NostrError, type NostrIdentity, type OAuthConfig, type OAuthResult, type OAuthTokenResponse, OpenKey, type OpenKeyConfig, type OpenKeyError, type OpenKeyMode, OpenKeyNostr, OpenKeyProvider, type SignMessageRequest, type SignOutAcknowledgement, type SignResult, type SignTypedDataRequest, type SignedNostrEvent, type TinyCloudAuthorizationRequestV1, type TinyCloudAuthorizationResultV1, type UnsignedNostrEvent, OpenKey as default, getOpenKey, passkeysQueryFlag, resolveAuthorizeTinyCloudRouting, shouldRouteAuthorizeTinyCloudExternal, validateIframeResize };
|
package/dist/index.d.ts
CHANGED
|
@@ -27,7 +27,8 @@ interface NostrError {
|
|
|
27
27
|
*/
|
|
28
28
|
declare class OpenKeyNostr {
|
|
29
29
|
private host;
|
|
30
|
-
|
|
30
|
+
private passkeysSupported;
|
|
31
|
+
constructor(host: string, passkeysSupported?: boolean);
|
|
31
32
|
/**
|
|
32
33
|
* Get-or-create the user's OpenKey-custodied Nostr identity. Always shows
|
|
33
34
|
* a visible consent card (identity creation, or - when `relayUrl` is
|
|
@@ -67,7 +68,19 @@ interface OpenKeyConfig {
|
|
|
67
68
|
mode?: OpenKeyMode;
|
|
68
69
|
/** App-provided wallet provider for external key signing */
|
|
69
70
|
externalProvider?: EIP1193Provider;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the client can use passkeys (WebAuthn). Default: true. Pass
|
|
73
|
+
* false from clients where WebAuthn does not work (for example an
|
|
74
|
+
* ad-hoc-signed desktop webview); the OpenKey UI then offers only email
|
|
75
|
+
* and social sign-in.
|
|
76
|
+
*/
|
|
77
|
+
passkeysSupported?: boolean;
|
|
70
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Query suffix telling the OpenKey widget that passkeys are unavailable.
|
|
81
|
+
* Empty when passkeys are supported, so default URLs are unchanged.
|
|
82
|
+
*/
|
|
83
|
+
declare function passkeysQueryFlag(passkeysSupported: boolean): string;
|
|
71
84
|
interface SignMessageRequest {
|
|
72
85
|
message: string;
|
|
73
86
|
keyId?: string;
|
|
@@ -325,18 +338,18 @@ declare class OpenKey {
|
|
|
325
338
|
private oauthHost;
|
|
326
339
|
private appName;
|
|
327
340
|
private mode;
|
|
341
|
+
private passkeysSupported;
|
|
328
342
|
private config;
|
|
329
343
|
private popup;
|
|
330
344
|
private lastAuth;
|
|
331
345
|
private discoveredProviders;
|
|
332
|
-
private sessionToken;
|
|
333
346
|
/** Cancels widget flows that could outlive a sign-out on this instance. */
|
|
334
347
|
private activeFlowCancellations;
|
|
335
348
|
/**
|
|
336
349
|
* Nostr identity custody + signing (secp256k1 Schnorr / BIP-340). Kept
|
|
337
350
|
* fully separate from the Ethereum flows above: it never reuses
|
|
338
|
-
* `lastAuth
|
|
339
|
-
*
|
|
351
|
+
* `lastAuth`, and its widget messages never carry a session token -
|
|
352
|
+
* the OpenKey session and any signing grants stay inside
|
|
340
353
|
* the OpenKey-origin iframe for the whole lifetime of this client.
|
|
341
354
|
*/
|
|
342
355
|
readonly nostr: OpenKeyNostr;
|
|
@@ -371,24 +384,28 @@ declare class OpenKey {
|
|
|
371
384
|
/**
|
|
372
385
|
* Signs the active OpenKey account out through the OpenKey-owned widget.
|
|
373
386
|
*
|
|
374
|
-
* The
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
387
|
+
* The OpenKey-owned widget revokes the OpenKey session it holds itself;
|
|
388
|
+
* the SDK never holds an OpenKey session token. Local SDK state is cleared
|
|
389
|
+
* before opening the widget, including when remote revocation is
|
|
390
|
+
* unavailable.
|
|
378
391
|
*/
|
|
379
392
|
signOut(opts?: {
|
|
380
393
|
mode?: OpenKeyMode;
|
|
381
394
|
}): Promise<SignOutAcknowledgement>;
|
|
382
395
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
396
|
+
* Always null. OpenKey no longer gives its session token to the embedding
|
|
397
|
+
* page (TC-688): the token unlocked OpenKey's key and account APIs, not
|
|
398
|
+
* just the requesting app's flows.
|
|
399
|
+
*
|
|
400
|
+
* @deprecated Kept so existing callers compile. Third-party server-side
|
|
401
|
+
* signing uses an OAuth access token from the OpenKey OAuth flow.
|
|
386
402
|
*/
|
|
387
403
|
getSessionToken(): string | null;
|
|
388
404
|
/**
|
|
389
|
-
* Endpoint
|
|
390
|
-
*
|
|
391
|
-
*
|
|
405
|
+
* Endpoint for a TinyCloud auto-sign signing strategy. `token` is always
|
|
406
|
+
* null; see {@link OpenKey.getSessionToken}.
|
|
407
|
+
*
|
|
408
|
+
* @deprecated The endpoint accepts an OAuth access token as its bearer.
|
|
392
409
|
*/
|
|
393
410
|
tinycloudSigningOptions(): {
|
|
394
411
|
endpoint: string;
|
|
@@ -551,4 +568,4 @@ declare class OpenKeyProvider implements EIP1193Provider {
|
|
|
551
568
|
|
|
552
569
|
declare function getOpenKey(config?: OpenKeyConfig): OpenKey;
|
|
553
570
|
|
|
554
|
-
export { type AuthResult, type AuthorizeTinyCloudRouting, type CapabilityPresentationEnvelopeV1, type EIP1193Provider, KeyIdTypeMismatchError, type NostrError, type NostrIdentity, type OAuthConfig, type OAuthResult, type OAuthTokenResponse, OpenKey, type OpenKeyConfig, type OpenKeyError, type OpenKeyMode, OpenKeyNostr, OpenKeyProvider, type SignMessageRequest, type SignOutAcknowledgement, type SignResult, type SignTypedDataRequest, type SignedNostrEvent, type TinyCloudAuthorizationRequestV1, type TinyCloudAuthorizationResultV1, type UnsignedNostrEvent, OpenKey as default, getOpenKey, resolveAuthorizeTinyCloudRouting, shouldRouteAuthorizeTinyCloudExternal, validateIframeResize };
|
|
571
|
+
export { type AuthResult, type AuthorizeTinyCloudRouting, type CapabilityPresentationEnvelopeV1, type EIP1193Provider, KeyIdTypeMismatchError, type NostrError, type NostrIdentity, type OAuthConfig, type OAuthResult, type OAuthTokenResponse, OpenKey, type OpenKeyConfig, type OpenKeyError, type OpenKeyMode, OpenKeyNostr, OpenKeyProvider, type SignMessageRequest, type SignOutAcknowledgement, type SignResult, type SignTypedDataRequest, type SignedNostrEvent, type TinyCloudAuthorizationRequestV1, type TinyCloudAuthorizationResultV1, type UnsignedNostrEvent, OpenKey as default, getOpenKey, passkeysQueryFlag, resolveAuthorizeTinyCloudRouting, shouldRouteAuthorizeTinyCloudExternal, validateIframeResize };
|
package/dist/index.js
CHANGED
|
@@ -26,6 +26,7 @@ __export(index_exports, {
|
|
|
26
26
|
OpenKeyProvider: () => OpenKeyProvider,
|
|
27
27
|
default: () => index_default,
|
|
28
28
|
getOpenKey: () => getOpenKey,
|
|
29
|
+
passkeysQueryFlag: () => passkeysQueryFlag,
|
|
29
30
|
resolveAuthorizeTinyCloudRouting: () => resolveAuthorizeTinyCloudRouting,
|
|
30
31
|
shouldRouteAuthorizeTinyCloudExternal: () => shouldRouteAuthorizeTinyCloudExternal,
|
|
31
32
|
validateIframeResize: () => validateIframeResize
|
|
@@ -175,8 +176,9 @@ var NostrFrame = class {
|
|
|
175
176
|
}
|
|
176
177
|
};
|
|
177
178
|
var OpenKeyNostr = class {
|
|
178
|
-
constructor(host) {
|
|
179
|
+
constructor(host, passkeysSupported = true) {
|
|
179
180
|
this.host = host;
|
|
181
|
+
this.passkeysSupported = passkeysSupported;
|
|
180
182
|
}
|
|
181
183
|
/**
|
|
182
184
|
* Get-or-create the user's OpenKey-custodied Nostr identity. Always shows
|
|
@@ -219,7 +221,8 @@ var OpenKeyNostr = class {
|
|
|
219
221
|
}
|
|
220
222
|
widgetUrl() {
|
|
221
223
|
const origin = encodeURIComponent(window.location.origin);
|
|
222
|
-
|
|
224
|
+
const passkeysFlag = this.passkeysSupported ? "" : "&passkeys=false";
|
|
225
|
+
return `${this.host}/widget/embed/nostr/approve?origin=${origin}${passkeysFlag}`;
|
|
223
226
|
}
|
|
224
227
|
run(url, request, onData) {
|
|
225
228
|
return new Promise((resolve, reject) => {
|
|
@@ -263,6 +266,9 @@ var OpenKeyNostr = class {
|
|
|
263
266
|
};
|
|
264
267
|
|
|
265
268
|
// src/index.ts
|
|
269
|
+
function passkeysQueryFlag(passkeysSupported) {
|
|
270
|
+
return passkeysSupported ? "" : "&passkeys=false";
|
|
271
|
+
}
|
|
266
272
|
var DEFAULT_HOST = "https://openkey.so";
|
|
267
273
|
var POPUP_WIDTH = 400;
|
|
268
274
|
var POPUP_HEIGHT = 600;
|
|
@@ -582,18 +588,18 @@ var OpenKey = class {
|
|
|
582
588
|
oauthHost;
|
|
583
589
|
appName;
|
|
584
590
|
mode;
|
|
591
|
+
passkeysSupported;
|
|
585
592
|
config;
|
|
586
593
|
popup = null;
|
|
587
594
|
lastAuth = null;
|
|
588
595
|
discoveredProviders = [];
|
|
589
|
-
sessionToken = null;
|
|
590
596
|
/** Cancels widget flows that could outlive a sign-out on this instance. */
|
|
591
597
|
activeFlowCancellations = /* @__PURE__ */ new Set();
|
|
592
598
|
/**
|
|
593
599
|
* Nostr identity custody + signing (secp256k1 Schnorr / BIP-340). Kept
|
|
594
600
|
* fully separate from the Ethereum flows above: it never reuses
|
|
595
|
-
* `lastAuth
|
|
596
|
-
*
|
|
601
|
+
* `lastAuth`, and its widget messages never carry a session token -
|
|
602
|
+
* the OpenKey session and any signing grants stay inside
|
|
597
603
|
* the OpenKey-origin iframe for the whole lifetime of this client.
|
|
598
604
|
*/
|
|
599
605
|
nostr;
|
|
@@ -603,7 +609,8 @@ var OpenKey = class {
|
|
|
603
609
|
this.oauthHost = config.oauthHost || this.deriveOAuthHost(this.host);
|
|
604
610
|
this.appName = config.appName || window.location.hostname;
|
|
605
611
|
this.mode = config.mode ?? "iframe";
|
|
606
|
-
this.
|
|
612
|
+
this.passkeysSupported = config.passkeysSupported ?? true;
|
|
613
|
+
this.nostr = new OpenKeyNostr(this.host, this.passkeysSupported);
|
|
607
614
|
if (typeof window !== "undefined") {
|
|
608
615
|
this.discoveredProviders = [];
|
|
609
616
|
window.addEventListener("eip6963:announceProvider", (event) => {
|
|
@@ -675,25 +682,22 @@ var OpenKey = class {
|
|
|
675
682
|
/**
|
|
676
683
|
* Signs the active OpenKey account out through the OpenKey-owned widget.
|
|
677
684
|
*
|
|
678
|
-
* The
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
685
|
+
* The OpenKey-owned widget revokes the OpenKey session it holds itself;
|
|
686
|
+
* the SDK never holds an OpenKey session token. Local SDK state is cleared
|
|
687
|
+
* before opening the widget, including when remote revocation is
|
|
688
|
+
* unavailable.
|
|
682
689
|
*/
|
|
683
690
|
async signOut(opts) {
|
|
684
691
|
const requestId = `ok-signout-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
685
|
-
const sessionToken = this.sessionToken || void 0;
|
|
686
692
|
const mode = this.resolveMode(opts?.mode) === "redirect" ? "popup" : opts?.mode;
|
|
687
693
|
this.cancelActiveFlows();
|
|
688
694
|
this.lastAuth = null;
|
|
689
|
-
this.sessionToken = null;
|
|
690
695
|
const acknowledgement = await this.openFlow(
|
|
691
696
|
"sign-out",
|
|
692
697
|
{
|
|
693
698
|
type: "openkey:sign-out:request",
|
|
694
699
|
requestId,
|
|
695
|
-
protocolVersion: 1
|
|
696
|
-
sessionToken
|
|
700
|
+
protocolVersion: 1
|
|
697
701
|
},
|
|
698
702
|
mode
|
|
699
703
|
);
|
|
@@ -703,22 +707,26 @@ var OpenKey = class {
|
|
|
703
707
|
return acknowledgement;
|
|
704
708
|
}
|
|
705
709
|
/**
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
710
|
+
* Always null. OpenKey no longer gives its session token to the embedding
|
|
711
|
+
* page (TC-688): the token unlocked OpenKey's key and account APIs, not
|
|
712
|
+
* just the requesting app's flows.
|
|
713
|
+
*
|
|
714
|
+
* @deprecated Kept so existing callers compile. Third-party server-side
|
|
715
|
+
* signing uses an OAuth access token from the OpenKey OAuth flow.
|
|
709
716
|
*/
|
|
710
717
|
getSessionToken() {
|
|
711
|
-
return
|
|
718
|
+
return null;
|
|
712
719
|
}
|
|
713
720
|
/**
|
|
714
|
-
* Endpoint
|
|
715
|
-
*
|
|
716
|
-
*
|
|
721
|
+
* Endpoint for a TinyCloud auto-sign signing strategy. `token` is always
|
|
722
|
+
* null; see {@link OpenKey.getSessionToken}.
|
|
723
|
+
*
|
|
724
|
+
* @deprecated The endpoint accepts an OAuth access token as its bearer.
|
|
717
725
|
*/
|
|
718
726
|
tinycloudSigningOptions() {
|
|
719
727
|
return {
|
|
720
728
|
endpoint: `${this.oauthHost}/api/delegate/sign`,
|
|
721
|
-
token:
|
|
729
|
+
token: null
|
|
722
730
|
};
|
|
723
731
|
}
|
|
724
732
|
/**
|
|
@@ -803,8 +811,7 @@ var OpenKey = class {
|
|
|
803
811
|
// context. The envelope is display-only; the widget transport
|
|
804
812
|
// validates and size-bounds it before use and NEVER treats it as
|
|
805
813
|
// verified unless the server actually origin-binds a manifest.
|
|
806
|
-
presentation: request.presentation
|
|
807
|
-
sessionToken: this.sessionToken || void 0
|
|
814
|
+
presentation: request.presentation
|
|
808
815
|
},
|
|
809
816
|
opts?.mode
|
|
810
817
|
);
|
|
@@ -881,7 +888,6 @@ var OpenKey = class {
|
|
|
881
888
|
// bounded at the transport, never treated as verified without
|
|
882
889
|
// server-side origin-binding.
|
|
883
890
|
presentation: request.presentation,
|
|
884
|
-
sessionToken: this.sessionToken || void 0,
|
|
885
891
|
// Sol MAJOR-3 (continuation): tell the widget to hand us back
|
|
886
892
|
// the previewApproval instead of asking OpenKey to sign
|
|
887
893
|
// server-side with a managed key. The widget will still render
|
|
@@ -1035,15 +1041,13 @@ var OpenKey = class {
|
|
|
1035
1041
|
return this.openFlow("sign", {
|
|
1036
1042
|
type: "openkey:sign:request",
|
|
1037
1043
|
message: request.message,
|
|
1038
|
-
keyId: request.keyId
|
|
1039
|
-
sessionToken: this.sessionToken || void 0
|
|
1044
|
+
keyId: request.keyId
|
|
1040
1045
|
}, mode);
|
|
1041
1046
|
}
|
|
1042
1047
|
signTypedDataWithOpenKey(request, mode) {
|
|
1043
1048
|
return this.openFlow("sign-typed-data", {
|
|
1044
1049
|
type: "openkey:signTypedData:request",
|
|
1045
|
-
data: request
|
|
1046
|
-
sessionToken: this.sessionToken || void 0
|
|
1050
|
+
data: request
|
|
1047
1051
|
}, mode);
|
|
1048
1052
|
}
|
|
1049
1053
|
toHex(str) {
|
|
@@ -1253,17 +1257,18 @@ var OpenKey = class {
|
|
|
1253
1257
|
const mode = this.resolveMode(modeOverride);
|
|
1254
1258
|
const origin = encodeURIComponent(window.location.origin);
|
|
1255
1259
|
const eoaFlag = action === "connect" && this.hasDetectedEoa() ? "&hasEoa=true" : "";
|
|
1260
|
+
const passkeysFlag = passkeysQueryFlag(this.passkeysSupported);
|
|
1256
1261
|
if (mode === "popup") {
|
|
1257
|
-
const url2 = `${this.host}/widget/${action}?origin=${origin}${eoaFlag}`;
|
|
1262
|
+
const url2 = `${this.host}/widget/${action}?origin=${origin}${eoaFlag}${passkeysFlag}`;
|
|
1258
1263
|
return new Promise((resolve, reject) => this.openPopup(action, url2, message, resolve, reject));
|
|
1259
1264
|
}
|
|
1260
1265
|
if (mode === "redirect") {
|
|
1261
|
-
const url2 = `${this.host}/widget/${action}?origin=${origin}${eoaFlag}`;
|
|
1266
|
+
const url2 = `${this.host}/widget/${action}?origin=${origin}${eoaFlag}${passkeysFlag}`;
|
|
1262
1267
|
window.location.href = url2;
|
|
1263
1268
|
return new Promise(() => {
|
|
1264
1269
|
});
|
|
1265
1270
|
}
|
|
1266
|
-
const url = `${this.host}/widget/embed/${action}?origin=${origin}${eoaFlag}`;
|
|
1271
|
+
const url = `${this.host}/widget/embed/${action}?origin=${origin}${eoaFlag}${passkeysFlag}`;
|
|
1267
1272
|
return this.openIframeModal(url, action, message, origin);
|
|
1268
1273
|
}
|
|
1269
1274
|
openIframeModal(url, action, message, origin) {
|
|
@@ -1329,7 +1334,6 @@ var OpenKey = class {
|
|
|
1329
1334
|
cleanup();
|
|
1330
1335
|
if (data.success) {
|
|
1331
1336
|
if (data.type === "openkey:auth:response") {
|
|
1332
|
-
if (data.sessionToken) this.sessionToken = data.sessionToken;
|
|
1333
1337
|
resolve({ address: data.address, keyId: data.keyId, keyType: data.keyType || "MANAGED" });
|
|
1334
1338
|
} else if (data.type === "openkey:link-wallet:response") {
|
|
1335
1339
|
resolve({ address: data.address, keyId: data.keyId });
|
|
@@ -1370,7 +1374,7 @@ var OpenKey = class {
|
|
|
1370
1374
|
cleanup();
|
|
1371
1375
|
console.warn("OpenKey: iframe blocked by CSP, falling back to popup. Add frame-src https://openkey.so to your CSP.");
|
|
1372
1376
|
showToast();
|
|
1373
|
-
const popupUrl = `${this.host}/widget/${action}?origin=${origin}`;
|
|
1377
|
+
const popupUrl = `${this.host}/widget/${action}?origin=${origin}${passkeysQueryFlag(this.passkeysSupported)}`;
|
|
1374
1378
|
this.openPopup(action, popupUrl, message, (val) => settle(() => resolve(val)), (err) => settle(() => reject(err)));
|
|
1375
1379
|
}, IFRAME_READY_TIMEOUT);
|
|
1376
1380
|
const overallTimeout = setTimeout(() => {
|
|
@@ -1552,7 +1556,6 @@ var OpenKey = class {
|
|
|
1552
1556
|
popup.close();
|
|
1553
1557
|
if (data.success) {
|
|
1554
1558
|
if (data.type === "openkey:auth:response") {
|
|
1555
|
-
if (data.sessionToken) this.sessionToken = data.sessionToken;
|
|
1556
1559
|
resolve({ address: data.address, keyId: data.keyId, keyType: data.keyType || "MANAGED" });
|
|
1557
1560
|
} else if (data.type === "openkey:link-wallet:response") {
|
|
1558
1561
|
resolve({ address: data.address, keyId: data.keyId });
|
|
@@ -1675,6 +1678,7 @@ function getOpenKey(config) {
|
|
|
1675
1678
|
OpenKeyNostr,
|
|
1676
1679
|
OpenKeyProvider,
|
|
1677
1680
|
getOpenKey,
|
|
1681
|
+
passkeysQueryFlag,
|
|
1678
1682
|
resolveAuthorizeTinyCloudRouting,
|
|
1679
1683
|
shouldRouteAuthorizeTinyCloudExternal,
|
|
1680
1684
|
validateIframeResize
|