@gvnrdao/dh-sdk 0.0.303 → 0.0.304
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/browser/dist/browser.js +1 -1
- package/dist/index.js +178 -42
- package/dist/index.mjs +178 -42
- package/dist/modules/diamond-hands-sdk.d.ts +28 -4
- package/dist/utils/server-session.d.ts +31 -2
- package/package.json +1 -1
|
@@ -60,14 +60,31 @@ export declare class ServerSession {
|
|
|
60
60
|
private readonly fetchImpl;
|
|
61
61
|
private cached;
|
|
62
62
|
private inFlight;
|
|
63
|
+
/**
|
|
64
|
+
* Bumped by `clearPersisted()` (logout / disconnect). An in-flight
|
|
65
|
+
* `getOrRefresh()` captures this at start and refuses to write its freshly
|
|
66
|
+
* minted token back to `this.cached`/the store if the value changed
|
|
67
|
+
* meanwhile — so a refresh racing a sign-out can't silently "un-clear" the
|
|
68
|
+
* credential it was told to drop.
|
|
69
|
+
*/
|
|
70
|
+
private generation;
|
|
63
71
|
/**
|
|
64
72
|
* Store key for the current signer, memoized on first use so the sync
|
|
65
73
|
* `clear()` can drop the persisted token without an async address lookup.
|
|
66
74
|
*/
|
|
67
75
|
private lastStoreKey;
|
|
68
76
|
constructor(opts: ServerSessionOptions);
|
|
69
|
-
/**
|
|
70
|
-
|
|
77
|
+
/**
|
|
78
|
+
* Returns a JWT good for at least `REFRESH_LEEWAY_SECONDS` more seconds.
|
|
79
|
+
* Pass `{ silent: true }` to forbid a fresh wallet signature: it resolves ONLY
|
|
80
|
+
* from a live cached token or the persisted re-mint envelope, never prompting
|
|
81
|
+
* and never joining a prompt-capable in-flight refresh (used by `logout()`,
|
|
82
|
+
* which must never pop the wallet during sign-out). Rejects when only a fresh
|
|
83
|
+
* signature could produce a token.
|
|
84
|
+
*/
|
|
85
|
+
getValidToken(opts?: {
|
|
86
|
+
silent?: boolean;
|
|
87
|
+
}): Promise<string>;
|
|
71
88
|
/** Convenience for fetch: spread directly into `headers`. */
|
|
72
89
|
getAuthHeader(): Promise<Record<string, string>>;
|
|
73
90
|
/**
|
|
@@ -89,6 +106,18 @@ export declare class ServerSession {
|
|
|
89
106
|
* of server response so the client stops presenting the token.
|
|
90
107
|
*/
|
|
91
108
|
logout(): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* Resolve a session WITHOUT ever prompting for a wallet signature: a live
|
|
111
|
+
* cached token, else the persisted JWT (adopted if still fresh, otherwise
|
|
112
|
+
* silently re-minted from the envelope). Returns `null` only when a fresh
|
|
113
|
+
* wallet signature would be required (dead/absent envelope). Never touches
|
|
114
|
+
* `this.inFlight`, so a silent caller (logout) can resolve independently
|
|
115
|
+
* instead of being dragged into a prompt-capable refresh already in flight.
|
|
116
|
+
*
|
|
117
|
+
* `gen` is the caller's clear-generation snapshot: writes to `this.cached`
|
|
118
|
+
* and the store are skipped if a `clearPersisted()` landed meanwhile.
|
|
119
|
+
*/
|
|
120
|
+
private tryResolveSilently;
|
|
92
121
|
private getOrRefresh;
|
|
93
122
|
private login;
|
|
94
123
|
/**
|
package/package.json
CHANGED