@bounded-sh/core 0.0.26 → 0.0.34
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/client/config.d.ts +8 -10
- package/dist/client/live.d.ts +11 -2
- package/dist/index.js +32 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +32 -19
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -6
package/dist/index.mjs
CHANGED
|
@@ -19,14 +19,10 @@ let clientConfig = {
|
|
|
19
19
|
humanAuthApiUrl: 'https://auth.bounded.sh',
|
|
20
20
|
functionsUrl: 'https://functions.bounded.sh',
|
|
21
21
|
appId: '',
|
|
22
|
-
// No hidden
|
|
23
|
-
//
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
// Bounded explicitly enables it for the issuer. For
|
|
27
|
-
// crypto/onchain wallet login use authMethod:'phantom' (Solana / Phantom), or
|
|
28
|
-
// signInAnonymously() for zero-friction 'guest' accounts. ('wallet' is an
|
|
29
|
-
// unimplemented stub; don't use.)
|
|
22
|
+
// No hidden modal fallback: browser clients start hosted Bounded Auth with
|
|
23
|
+
// loginWithRedirect/loginWithPopup. For crypto/onchain wallet login use
|
|
24
|
+
// authMethod:'phantom' (Solana / Phantom), and use signInAnonymously() for
|
|
25
|
+
// zero-friction guest accounts. ('wallet' is an unimplemented stub; don't use.)
|
|
30
26
|
authMethod: 'none',
|
|
31
27
|
chain: '',
|
|
32
28
|
rpcUrl: '',
|
|
@@ -2806,6 +2802,7 @@ async function genAuthNonce() {
|
|
|
2806
2802
|
// from 'phantom' and couldn't be gated or flagged.
|
|
2807
2803
|
const SIGNATURE_AUTH_METHODS = new Set(['phantom', 'mobile-wallet-adapter', 'guest']);
|
|
2808
2804
|
async function createSessionWithSignature(address, message, signature) {
|
|
2805
|
+
var _a, _b;
|
|
2809
2806
|
const client = await getAxiosAuthClient();
|
|
2810
2807
|
const config = await getConfig();
|
|
2811
2808
|
const appId = config.appId;
|
|
@@ -2815,14 +2812,30 @@ async function createSessionWithSignature(address, message, signature) {
|
|
|
2815
2812
|
// for a signature exchange. This is what makes the server SDK + guest device
|
|
2816
2813
|
// keypair work under the email-default config.
|
|
2817
2814
|
const authMethod = SIGNATURE_AUTH_METHODS.has(config.authMethod) ? config.authMethod : 'phantom';
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2815
|
+
try {
|
|
2816
|
+
const response = await client.post('/session', {
|
|
2817
|
+
appId,
|
|
2818
|
+
address,
|
|
2819
|
+
message,
|
|
2820
|
+
signature,
|
|
2821
|
+
authMethod
|
|
2822
|
+
});
|
|
2823
|
+
return response.data;
|
|
2824
|
+
}
|
|
2825
|
+
catch (err) {
|
|
2826
|
+
// Surface the issuer's actionable message (e.g. "Anonymous auth is not enabled for
|
|
2827
|
+
// this app. Add \"auth\": { \"anonymous\": true } to policy.json and redeploy.")
|
|
2828
|
+
// instead of axios's generic "Request failed with status code 403".
|
|
2829
|
+
const d = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2830
|
+
if (d && (d.message || d.error)) {
|
|
2831
|
+
const e = new Error(String(d.message || d.error));
|
|
2832
|
+
e.code = d.error;
|
|
2833
|
+
e.status = (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.status;
|
|
2834
|
+
e.hint = d.hint;
|
|
2835
|
+
throw e;
|
|
2836
|
+
}
|
|
2837
|
+
throw err;
|
|
2838
|
+
}
|
|
2826
2839
|
}
|
|
2827
2840
|
// Deduplicate concurrent refreshSession calls to prevent multiple code paths
|
|
2828
2841
|
// (WebSocket reconnection, periodic refresh, API 401 retry) from all hitting
|
|
@@ -7120,8 +7133,8 @@ async function status(roomPath, opts = {}) {
|
|
|
7120
7133
|
* claims); pass `opts.userId` to override. Returns the unsubscribe function
|
|
7121
7134
|
* (a Promise<() => Promise<void>>, same as `subscribe`).
|
|
7122
7135
|
*
|
|
7123
|
-
*
|
|
7124
|
-
*
|
|
7136
|
+
* Server/agent consumers: use `WalletClient.live.subscribeView` (it supplies
|
|
7137
|
+
* the wallet session + view id); browser apps just call this directly.
|
|
7125
7138
|
*/
|
|
7126
7139
|
async function subscribeView(roomPath, opts) {
|
|
7127
7140
|
if (!roomPath || typeof roomPath !== 'string') {
|
|
@@ -7151,7 +7164,7 @@ async function subscribeView(roomPath, opts) {
|
|
|
7151
7164
|
// derives the room from the `?path=` the connection carries). Without this the
|
|
7152
7165
|
// subscription lands on the app-level project DO and never sees the room's
|
|
7153
7166
|
// ephemeral view writes.
|
|
7154
|
-
return subscribeV2(viewPath, { onData: opts.onData, onError: opts.onError }, normalizedRoomPath);
|
|
7167
|
+
return subscribeV2(viewPath, { onData: opts.onData, onError: opts.onError, _overrides: opts._overrides }, normalizedRoomPath);
|
|
7155
7168
|
}
|
|
7156
7169
|
/** The `bounded.live` namespace surface. */
|
|
7157
7170
|
const live = { intent, status, subscribeView };
|