@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/client/config.d.ts
CHANGED
|
@@ -3,12 +3,11 @@ export interface ClientConfig {
|
|
|
3
3
|
name: string;
|
|
4
4
|
logoUrl: string;
|
|
5
5
|
/** Auth method. Configure exactly one method at init time.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* device-key auth. */
|
|
6
|
+
* Bounded Auth is the default restore/logout surface; start email, social,
|
|
7
|
+
* and optional text login with loginWithRedirect/loginWithPopup.
|
|
8
|
+
* 'phantom' = connect a Solana wallet (Phantom), for crypto/onchain apps
|
|
9
|
+
* that need a real @user.address. Guests use signInAnonymously(), not
|
|
10
|
+
* authMethod. */
|
|
12
11
|
authMethod: 'none' | 'email' | 'guest' | 'wallet' | 'rainbowkit' | 'coinbase-smart-wallet' | 'onboard' | 'phantom' | 'mobile-wallet-adapter' | 'privy' | 'privy-expo';
|
|
13
12
|
wsApiUrl: string;
|
|
14
13
|
apiUrl: string;
|
|
@@ -21,10 +20,9 @@ export interface ClientConfig {
|
|
|
21
20
|
appId: string;
|
|
22
21
|
/** Wallet/SIWS issuer (wallet + guest providers sign challenges against this). */
|
|
23
22
|
authApiUrl: string;
|
|
24
|
-
/** Human-login issuer
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* Defaults per network. */
|
|
23
|
+
/** Human-login issuer for hosted Bounded Auth: email OTP, OAuth/social, and
|
|
24
|
+
* optional text OTP. App-origin OTP helpers are retired; use hosted
|
|
25
|
+
* loginWithRedirect/loginWithPopup against this issuer. Defaults per network. */
|
|
28
26
|
humanAuthApiUrl?: string;
|
|
29
27
|
/**
|
|
30
28
|
* Selects a Bounded backend preset. When set, the endpoint defaults
|
package/dist/client/live.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RequestOverrides } from './operations';
|
|
2
|
+
import type { SubscriptionOptions } from '../types';
|
|
2
3
|
export type LiveIntentOptions = {
|
|
3
4
|
/** Per-call timeout (ms) for the HTTP request to the realtime worker. */
|
|
4
5
|
timeoutMs?: number;
|
|
@@ -79,6 +80,14 @@ export type SubscribeViewOptions = {
|
|
|
79
80
|
onData: (view: any) => void;
|
|
80
81
|
/** Called on subscription error. */
|
|
81
82
|
onError?: (error: any) => void;
|
|
83
|
+
/**
|
|
84
|
+
* @internal Per-subscription auth overrides (server `WalletClient` path).
|
|
85
|
+
* Lets a keypair-backed agent player subscribe to its live view under its
|
|
86
|
+
* own wallet session instead of any global session — the same override seam
|
|
87
|
+
* `subscribe()` already honors. Without this, a Node agent could send
|
|
88
|
+
* intents but never SEE its view (the documented agent-as-player pattern).
|
|
89
|
+
*/
|
|
90
|
+
_overrides?: SubscriptionOptions['_overrides'];
|
|
82
91
|
};
|
|
83
92
|
/**
|
|
84
93
|
* Subscribe to YOUR per-player view of a room. Thin sugar over:
|
|
@@ -89,8 +98,8 @@ export type SubscribeViewOptions = {
|
|
|
89
98
|
* claims); pass `opts.userId` to override. Returns the unsubscribe function
|
|
90
99
|
* (a Promise<() => Promise<void>>, same as `subscribe`).
|
|
91
100
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
101
|
+
* Server/agent consumers: use `WalletClient.live.subscribeView` (it supplies
|
|
102
|
+
* the wallet session + view id); browser apps just call this directly.
|
|
94
103
|
*/
|
|
95
104
|
export declare function subscribeView(roomPath: string, opts: SubscribeViewOptions): Promise<() => Promise<void>>;
|
|
96
105
|
/** The `bounded.live` namespace surface. */
|
package/dist/index.js
CHANGED
|
@@ -39,14 +39,10 @@ let clientConfig = {
|
|
|
39
39
|
humanAuthApiUrl: 'https://auth.bounded.sh',
|
|
40
40
|
functionsUrl: 'https://functions.bounded.sh',
|
|
41
41
|
appId: '',
|
|
42
|
-
// No hidden
|
|
43
|
-
//
|
|
44
|
-
//
|
|
45
|
-
//
|
|
46
|
-
// Bounded explicitly enables it for the issuer. For
|
|
47
|
-
// crypto/onchain wallet login use authMethod:'phantom' (Solana / Phantom), or
|
|
48
|
-
// signInAnonymously() for zero-friction 'guest' accounts. ('wallet' is an
|
|
49
|
-
// unimplemented stub; don't use.)
|
|
42
|
+
// No hidden modal fallback: browser clients start hosted Bounded Auth with
|
|
43
|
+
// loginWithRedirect/loginWithPopup. For crypto/onchain wallet login use
|
|
44
|
+
// authMethod:'phantom' (Solana / Phantom), and use signInAnonymously() for
|
|
45
|
+
// zero-friction guest accounts. ('wallet' is an unimplemented stub; don't use.)
|
|
50
46
|
authMethod: 'none',
|
|
51
47
|
chain: '',
|
|
52
48
|
rpcUrl: '',
|
|
@@ -2826,6 +2822,7 @@ async function genAuthNonce() {
|
|
|
2826
2822
|
// from 'phantom' and couldn't be gated or flagged.
|
|
2827
2823
|
const SIGNATURE_AUTH_METHODS = new Set(['phantom', 'mobile-wallet-adapter', 'guest']);
|
|
2828
2824
|
async function createSessionWithSignature(address, message, signature) {
|
|
2825
|
+
var _a, _b;
|
|
2829
2826
|
const client = await getAxiosAuthClient();
|
|
2830
2827
|
const config = await getConfig();
|
|
2831
2828
|
const appId = config.appId;
|
|
@@ -2835,14 +2832,30 @@ async function createSessionWithSignature(address, message, signature) {
|
|
|
2835
2832
|
// for a signature exchange. This is what makes the server SDK + guest device
|
|
2836
2833
|
// keypair work under the email-default config.
|
|
2837
2834
|
const authMethod = SIGNATURE_AUTH_METHODS.has(config.authMethod) ? config.authMethod : 'phantom';
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2835
|
+
try {
|
|
2836
|
+
const response = await client.post('/session', {
|
|
2837
|
+
appId,
|
|
2838
|
+
address,
|
|
2839
|
+
message,
|
|
2840
|
+
signature,
|
|
2841
|
+
authMethod
|
|
2842
|
+
});
|
|
2843
|
+
return response.data;
|
|
2844
|
+
}
|
|
2845
|
+
catch (err) {
|
|
2846
|
+
// Surface the issuer's actionable message (e.g. "Anonymous auth is not enabled for
|
|
2847
|
+
// this app. Add \"auth\": { \"anonymous\": true } to policy.json and redeploy.")
|
|
2848
|
+
// instead of axios's generic "Request failed with status code 403".
|
|
2849
|
+
const d = (_a = err === null || err === void 0 ? void 0 : err.response) === null || _a === void 0 ? void 0 : _a.data;
|
|
2850
|
+
if (d && (d.message || d.error)) {
|
|
2851
|
+
const e = new Error(String(d.message || d.error));
|
|
2852
|
+
e.code = d.error;
|
|
2853
|
+
e.status = (_b = err === null || err === void 0 ? void 0 : err.response) === null || _b === void 0 ? void 0 : _b.status;
|
|
2854
|
+
e.hint = d.hint;
|
|
2855
|
+
throw e;
|
|
2856
|
+
}
|
|
2857
|
+
throw err;
|
|
2858
|
+
}
|
|
2846
2859
|
}
|
|
2847
2860
|
// Deduplicate concurrent refreshSession calls to prevent multiple code paths
|
|
2848
2861
|
// (WebSocket reconnection, periodic refresh, API 401 retry) from all hitting
|
|
@@ -7140,8 +7153,8 @@ async function status(roomPath, opts = {}) {
|
|
|
7140
7153
|
* claims); pass `opts.userId` to override. Returns the unsubscribe function
|
|
7141
7154
|
* (a Promise<() => Promise<void>>, same as `subscribe`).
|
|
7142
7155
|
*
|
|
7143
|
-
*
|
|
7144
|
-
*
|
|
7156
|
+
* Server/agent consumers: use `WalletClient.live.subscribeView` (it supplies
|
|
7157
|
+
* the wallet session + view id); browser apps just call this directly.
|
|
7145
7158
|
*/
|
|
7146
7159
|
async function subscribeView(roomPath, opts) {
|
|
7147
7160
|
if (!roomPath || typeof roomPath !== 'string') {
|
|
@@ -7171,7 +7184,7 @@ async function subscribeView(roomPath, opts) {
|
|
|
7171
7184
|
// derives the room from the `?path=` the connection carries). Without this the
|
|
7172
7185
|
// subscription lands on the app-level project DO and never sees the room's
|
|
7173
7186
|
// ephemeral view writes.
|
|
7174
|
-
return subscribeV2(viewPath, { onData: opts.onData, onError: opts.onError }, normalizedRoomPath);
|
|
7187
|
+
return subscribeV2(viewPath, { onData: opts.onData, onError: opts.onError, _overrides: opts._overrides }, normalizedRoomPath);
|
|
7175
7188
|
}
|
|
7176
7189
|
/** The `bounded.live` namespace surface. */
|
|
7177
7190
|
const live = { intent, status, subscribeView };
|