@openkey/sdk 0.10.1 → 0.10.2
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 +16 -13
- package/dist/index.d.ts +16 -13
- package/dist/index.js +22 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -329,14 +329,13 @@ declare class OpenKey {
|
|
|
329
329
|
private popup;
|
|
330
330
|
private lastAuth;
|
|
331
331
|
private discoveredProviders;
|
|
332
|
-
private sessionToken;
|
|
333
332
|
/** Cancels widget flows that could outlive a sign-out on this instance. */
|
|
334
333
|
private activeFlowCancellations;
|
|
335
334
|
/**
|
|
336
335
|
* Nostr identity custody + signing (secp256k1 Schnorr / BIP-340). Kept
|
|
337
336
|
* fully separate from the Ethereum flows above: it never reuses
|
|
338
|
-
* `lastAuth
|
|
339
|
-
*
|
|
337
|
+
* `lastAuth`, and its widget messages never carry a session token -
|
|
338
|
+
* the OpenKey session and any signing grants stay inside
|
|
340
339
|
* the OpenKey-origin iframe for the whole lifetime of this client.
|
|
341
340
|
*/
|
|
342
341
|
readonly nostr: OpenKeyNostr;
|
|
@@ -371,24 +370,28 @@ declare class OpenKey {
|
|
|
371
370
|
/**
|
|
372
371
|
* Signs the active OpenKey account out through the OpenKey-owned widget.
|
|
373
372
|
*
|
|
374
|
-
* The
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
373
|
+
* The OpenKey-owned widget revokes the OpenKey session it holds itself;
|
|
374
|
+
* the SDK never holds an OpenKey session token. Local SDK state is cleared
|
|
375
|
+
* before opening the widget, including when remote revocation is
|
|
376
|
+
* unavailable.
|
|
378
377
|
*/
|
|
379
378
|
signOut(opts?: {
|
|
380
379
|
mode?: OpenKeyMode;
|
|
381
380
|
}): Promise<SignOutAcknowledgement>;
|
|
382
381
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
382
|
+
* Always null. OpenKey no longer gives its session token to the embedding
|
|
383
|
+
* page (TC-688): the token unlocked OpenKey's key and account APIs, not
|
|
384
|
+
* just the requesting app's flows.
|
|
385
|
+
*
|
|
386
|
+
* @deprecated Kept so existing callers compile. Third-party server-side
|
|
387
|
+
* signing uses an OAuth access token from the OpenKey OAuth flow.
|
|
386
388
|
*/
|
|
387
389
|
getSessionToken(): string | null;
|
|
388
390
|
/**
|
|
389
|
-
* Endpoint
|
|
390
|
-
*
|
|
391
|
-
*
|
|
391
|
+
* Endpoint for a TinyCloud auto-sign signing strategy. `token` is always
|
|
392
|
+
* null; see {@link OpenKey.getSessionToken}.
|
|
393
|
+
*
|
|
394
|
+
* @deprecated The endpoint accepts an OAuth access token as its bearer.
|
|
392
395
|
*/
|
|
393
396
|
tinycloudSigningOptions(): {
|
|
394
397
|
endpoint: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -329,14 +329,13 @@ declare class OpenKey {
|
|
|
329
329
|
private popup;
|
|
330
330
|
private lastAuth;
|
|
331
331
|
private discoveredProviders;
|
|
332
|
-
private sessionToken;
|
|
333
332
|
/** Cancels widget flows that could outlive a sign-out on this instance. */
|
|
334
333
|
private activeFlowCancellations;
|
|
335
334
|
/**
|
|
336
335
|
* Nostr identity custody + signing (secp256k1 Schnorr / BIP-340). Kept
|
|
337
336
|
* fully separate from the Ethereum flows above: it never reuses
|
|
338
|
-
* `lastAuth
|
|
339
|
-
*
|
|
337
|
+
* `lastAuth`, and its widget messages never carry a session token -
|
|
338
|
+
* the OpenKey session and any signing grants stay inside
|
|
340
339
|
* the OpenKey-origin iframe for the whole lifetime of this client.
|
|
341
340
|
*/
|
|
342
341
|
readonly nostr: OpenKeyNostr;
|
|
@@ -371,24 +370,28 @@ declare class OpenKey {
|
|
|
371
370
|
/**
|
|
372
371
|
* Signs the active OpenKey account out through the OpenKey-owned widget.
|
|
373
372
|
*
|
|
374
|
-
* The
|
|
375
|
-
*
|
|
376
|
-
*
|
|
377
|
-
*
|
|
373
|
+
* The OpenKey-owned widget revokes the OpenKey session it holds itself;
|
|
374
|
+
* the SDK never holds an OpenKey session token. Local SDK state is cleared
|
|
375
|
+
* before opening the widget, including when remote revocation is
|
|
376
|
+
* unavailable.
|
|
378
377
|
*/
|
|
379
378
|
signOut(opts?: {
|
|
380
379
|
mode?: OpenKeyMode;
|
|
381
380
|
}): Promise<SignOutAcknowledgement>;
|
|
382
381
|
/**
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
*
|
|
382
|
+
* Always null. OpenKey no longer gives its session token to the embedding
|
|
383
|
+
* page (TC-688): the token unlocked OpenKey's key and account APIs, not
|
|
384
|
+
* just the requesting app's flows.
|
|
385
|
+
*
|
|
386
|
+
* @deprecated Kept so existing callers compile. Third-party server-side
|
|
387
|
+
* signing uses an OAuth access token from the OpenKey OAuth flow.
|
|
386
388
|
*/
|
|
387
389
|
getSessionToken(): string | null;
|
|
388
390
|
/**
|
|
389
|
-
* Endpoint
|
|
390
|
-
*
|
|
391
|
-
*
|
|
391
|
+
* Endpoint for a TinyCloud auto-sign signing strategy. `token` is always
|
|
392
|
+
* null; see {@link OpenKey.getSessionToken}.
|
|
393
|
+
*
|
|
394
|
+
* @deprecated The endpoint accepts an OAuth access token as its bearer.
|
|
392
395
|
*/
|
|
393
396
|
tinycloudSigningOptions(): {
|
|
394
397
|
endpoint: string;
|
package/dist/index.js
CHANGED
|
@@ -586,14 +586,13 @@ var OpenKey = class {
|
|
|
586
586
|
popup = null;
|
|
587
587
|
lastAuth = null;
|
|
588
588
|
discoveredProviders = [];
|
|
589
|
-
sessionToken = null;
|
|
590
589
|
/** Cancels widget flows that could outlive a sign-out on this instance. */
|
|
591
590
|
activeFlowCancellations = /* @__PURE__ */ new Set();
|
|
592
591
|
/**
|
|
593
592
|
* Nostr identity custody + signing (secp256k1 Schnorr / BIP-340). Kept
|
|
594
593
|
* fully separate from the Ethereum flows above: it never reuses
|
|
595
|
-
* `lastAuth
|
|
596
|
-
*
|
|
594
|
+
* `lastAuth`, and its widget messages never carry a session token -
|
|
595
|
+
* the OpenKey session and any signing grants stay inside
|
|
597
596
|
* the OpenKey-origin iframe for the whole lifetime of this client.
|
|
598
597
|
*/
|
|
599
598
|
nostr;
|
|
@@ -675,25 +674,22 @@ var OpenKey = class {
|
|
|
675
674
|
/**
|
|
676
675
|
* Signs the active OpenKey account out through the OpenKey-owned widget.
|
|
677
676
|
*
|
|
678
|
-
* The
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
*
|
|
677
|
+
* The OpenKey-owned widget revokes the OpenKey session it holds itself;
|
|
678
|
+
* the SDK never holds an OpenKey session token. Local SDK state is cleared
|
|
679
|
+
* before opening the widget, including when remote revocation is
|
|
680
|
+
* unavailable.
|
|
682
681
|
*/
|
|
683
682
|
async signOut(opts) {
|
|
684
683
|
const requestId = `ok-signout-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
685
|
-
const sessionToken = this.sessionToken || void 0;
|
|
686
684
|
const mode = this.resolveMode(opts?.mode) === "redirect" ? "popup" : opts?.mode;
|
|
687
685
|
this.cancelActiveFlows();
|
|
688
686
|
this.lastAuth = null;
|
|
689
|
-
this.sessionToken = null;
|
|
690
687
|
const acknowledgement = await this.openFlow(
|
|
691
688
|
"sign-out",
|
|
692
689
|
{
|
|
693
690
|
type: "openkey:sign-out:request",
|
|
694
691
|
requestId,
|
|
695
|
-
protocolVersion: 1
|
|
696
|
-
sessionToken
|
|
692
|
+
protocolVersion: 1
|
|
697
693
|
},
|
|
698
694
|
mode
|
|
699
695
|
);
|
|
@@ -703,22 +699,26 @@ var OpenKey = class {
|
|
|
703
699
|
return acknowledgement;
|
|
704
700
|
}
|
|
705
701
|
/**
|
|
706
|
-
*
|
|
707
|
-
*
|
|
708
|
-
*
|
|
702
|
+
* Always null. OpenKey no longer gives its session token to the embedding
|
|
703
|
+
* page (TC-688): the token unlocked OpenKey's key and account APIs, not
|
|
704
|
+
* just the requesting app's flows.
|
|
705
|
+
*
|
|
706
|
+
* @deprecated Kept so existing callers compile. Third-party server-side
|
|
707
|
+
* signing uses an OAuth access token from the OpenKey OAuth flow.
|
|
709
708
|
*/
|
|
710
709
|
getSessionToken() {
|
|
711
|
-
return
|
|
710
|
+
return null;
|
|
712
711
|
}
|
|
713
712
|
/**
|
|
714
|
-
* Endpoint
|
|
715
|
-
*
|
|
716
|
-
*
|
|
713
|
+
* Endpoint for a TinyCloud auto-sign signing strategy. `token` is always
|
|
714
|
+
* null; see {@link OpenKey.getSessionToken}.
|
|
715
|
+
*
|
|
716
|
+
* @deprecated The endpoint accepts an OAuth access token as its bearer.
|
|
717
717
|
*/
|
|
718
718
|
tinycloudSigningOptions() {
|
|
719
719
|
return {
|
|
720
720
|
endpoint: `${this.oauthHost}/api/delegate/sign`,
|
|
721
|
-
token:
|
|
721
|
+
token: null
|
|
722
722
|
};
|
|
723
723
|
}
|
|
724
724
|
/**
|
|
@@ -803,8 +803,7 @@ var OpenKey = class {
|
|
|
803
803
|
// context. The envelope is display-only; the widget transport
|
|
804
804
|
// validates and size-bounds it before use and NEVER treats it as
|
|
805
805
|
// verified unless the server actually origin-binds a manifest.
|
|
806
|
-
presentation: request.presentation
|
|
807
|
-
sessionToken: this.sessionToken || void 0
|
|
806
|
+
presentation: request.presentation
|
|
808
807
|
},
|
|
809
808
|
opts?.mode
|
|
810
809
|
);
|
|
@@ -881,7 +880,6 @@ var OpenKey = class {
|
|
|
881
880
|
// bounded at the transport, never treated as verified without
|
|
882
881
|
// server-side origin-binding.
|
|
883
882
|
presentation: request.presentation,
|
|
884
|
-
sessionToken: this.sessionToken || void 0,
|
|
885
883
|
// Sol MAJOR-3 (continuation): tell the widget to hand us back
|
|
886
884
|
// the previewApproval instead of asking OpenKey to sign
|
|
887
885
|
// server-side with a managed key. The widget will still render
|
|
@@ -1035,15 +1033,13 @@ var OpenKey = class {
|
|
|
1035
1033
|
return this.openFlow("sign", {
|
|
1036
1034
|
type: "openkey:sign:request",
|
|
1037
1035
|
message: request.message,
|
|
1038
|
-
keyId: request.keyId
|
|
1039
|
-
sessionToken: this.sessionToken || void 0
|
|
1036
|
+
keyId: request.keyId
|
|
1040
1037
|
}, mode);
|
|
1041
1038
|
}
|
|
1042
1039
|
signTypedDataWithOpenKey(request, mode) {
|
|
1043
1040
|
return this.openFlow("sign-typed-data", {
|
|
1044
1041
|
type: "openkey:signTypedData:request",
|
|
1045
|
-
data: request
|
|
1046
|
-
sessionToken: this.sessionToken || void 0
|
|
1042
|
+
data: request
|
|
1047
1043
|
}, mode);
|
|
1048
1044
|
}
|
|
1049
1045
|
toHex(str) {
|
|
@@ -1329,7 +1325,6 @@ var OpenKey = class {
|
|
|
1329
1325
|
cleanup();
|
|
1330
1326
|
if (data.success) {
|
|
1331
1327
|
if (data.type === "openkey:auth:response") {
|
|
1332
|
-
if (data.sessionToken) this.sessionToken = data.sessionToken;
|
|
1333
1328
|
resolve({ address: data.address, keyId: data.keyId, keyType: data.keyType || "MANAGED" });
|
|
1334
1329
|
} else if (data.type === "openkey:link-wallet:response") {
|
|
1335
1330
|
resolve({ address: data.address, keyId: data.keyId });
|
|
@@ -1552,7 +1547,6 @@ var OpenKey = class {
|
|
|
1552
1547
|
popup.close();
|
|
1553
1548
|
if (data.success) {
|
|
1554
1549
|
if (data.type === "openkey:auth:response") {
|
|
1555
|
-
if (data.sessionToken) this.sessionToken = data.sessionToken;
|
|
1556
1550
|
resolve({ address: data.address, keyId: data.keyId, keyType: data.keyType || "MANAGED" });
|
|
1557
1551
|
} else if (data.type === "openkey:link-wallet:response") {
|
|
1558
1552
|
resolve({ address: data.address, keyId: data.keyId });
|