@bounded-sh/client 0.0.117-sync.0 → 0.0.117
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/connections.d.ts +40 -0
- package/dist/{email-auth-provider-BFOw9iI9.js → email-auth-provider-BCWTczE2.js} +2 -2
- package/dist/{email-auth-provider-BFOw9iI9.js.map → email-auth-provider-BCWTczE2.js.map} +1 -1
- package/dist/{email-auth-provider-CmbRj-_I.mjs → email-auth-provider-CMfwB-Uj.mjs} +2 -2
- package/dist/{email-auth-provider-CmbRj-_I.mjs.map → email-auth-provider-CMfwB-Uj.mjs.map} +1 -1
- package/dist/{guest-auth-provider-Bvoaq-zC.mjs → guest-auth-provider-DH4iA0oS.mjs} +2 -2
- package/dist/{guest-auth-provider-Bvoaq-zC.mjs.map → guest-auth-provider-DH4iA0oS.mjs.map} +1 -1
- package/dist/{guest-auth-provider-DJD3zkBU.js → guest-auth-provider-DkX8cQqr.js} +2 -2
- package/dist/{guest-auth-provider-DJD3zkBU.js.map → guest-auth-provider-DkX8cQqr.js.map} +1 -1
- package/dist/{index-C2xAP67N.js → index-DrVV40Si.js} +136 -8
- package/dist/index-DrVV40Si.js.map +1 -0
- package/dist/{index-BmBLsYn2.mjs → index-Sx-Caknc.mjs} +132 -9
- package/dist/index-Sx-Caknc.mjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{injected-evm-wallet-provider-B2xteR2I.mjs → injected-evm-wallet-provider-BCZQuyPF.mjs} +2 -2
- package/dist/{injected-evm-wallet-provider-B2xteR2I.mjs.map → injected-evm-wallet-provider-BCZQuyPF.mjs.map} +1 -1
- package/dist/{injected-evm-wallet-provider-CL_FBjLe.js → injected-evm-wallet-provider-CVMhv4xf.js} +2 -2
- package/dist/{injected-evm-wallet-provider-CL_FBjLe.js.map → injected-evm-wallet-provider-CVMhv4xf.js.map} +1 -1
- package/dist/{injected-wallet-provider-Bc_xtyRd.js → injected-wallet-provider-BroBvwi6.js} +2 -2
- package/dist/{injected-wallet-provider-Bc_xtyRd.js.map → injected-wallet-provider-BroBvwi6.js.map} +1 -1
- package/dist/{injected-wallet-provider-DwozZ926.mjs → injected-wallet-provider-ezYLhye8.mjs} +2 -2
- package/dist/{injected-wallet-provider-DwozZ926.mjs.map → injected-wallet-provider-ezYLhye8.mjs.map} +1 -1
- package/package.json +2 -2
- package/dist/index-BmBLsYn2.mjs.map +0 -1
- package/dist/index-C2xAP67N.js.map +0 -1
|
@@ -6496,7 +6496,7 @@ async function getAuthProvider(config, fromStorage = false) {
|
|
|
6496
6496
|
// manager as legacy email sessions. Human login should be started
|
|
6497
6497
|
// with loginWithRedirect(); this provider is kept as the restore and
|
|
6498
6498
|
// logout surface for those sessions.
|
|
6499
|
-
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-
|
|
6499
|
+
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./email-auth-provider-BCWTczE2.js'); })).EmailAuthProvider();
|
|
6500
6500
|
break;
|
|
6501
6501
|
case "phantom": {
|
|
6502
6502
|
// First-class Solana WALLET LOGIN (the poof/TaroBase-style "connect
|
|
@@ -6538,7 +6538,7 @@ async function getAuthProvider(config, fromStorage = false) {
|
|
|
6538
6538
|
// (bounded-login-widget.ts), so registration never counts as
|
|
6539
6539
|
// evidence the user has a wallet.
|
|
6540
6540
|
await ensureSolanaMobileWalletRegistered(config, configuredNetwork);
|
|
6541
|
-
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-
|
|
6541
|
+
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-BroBvwi6.js'); });
|
|
6542
6542
|
currentAuthProvider = new InjectedWalletProvider(resolveInjectedWalletConfig(config), rpcUrl, configuredNetwork);
|
|
6543
6543
|
break;
|
|
6544
6544
|
}
|
|
@@ -6551,7 +6551,7 @@ async function getAuthProvider(config, fromStorage = false) {
|
|
|
6551
6551
|
// Selecting authMethod:'evm-wallet' IS the opt-in — pass evmWalletConfig
|
|
6552
6552
|
// to point at a specific wallet or set chainId/domain.
|
|
6553
6553
|
const evmWalletConfig = ((_a = config.evmWalletConfig) !== null && _a !== void 0 ? _a : {});
|
|
6554
|
-
const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-
|
|
6554
|
+
const { InjectedEvmWalletProvider } = await Promise.resolve().then(function () { return require('./injected-evm-wallet-provider-CVMhv4xf.js'); });
|
|
6555
6555
|
currentAuthProvider = new InjectedEvmWalletProvider(evmWalletConfig);
|
|
6556
6556
|
break;
|
|
6557
6557
|
}
|
|
@@ -6576,7 +6576,7 @@ async function getAuthProvider(config, fromStorage = false) {
|
|
|
6576
6576
|
break;
|
|
6577
6577
|
case "guest":
|
|
6578
6578
|
// Anonymous auth: a device-local ed25519 keypair signs the challenge.
|
|
6579
|
-
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-
|
|
6579
|
+
currentAuthProvider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-DkX8cQqr.js'); })).GuestAuthProvider();
|
|
6580
6580
|
break;
|
|
6581
6581
|
}
|
|
6582
6582
|
if (!currentAuthProvider) {
|
|
@@ -6638,7 +6638,7 @@ async function signInAnonymously() {
|
|
|
6638
6638
|
// Lazy-load the guest provider so its ed25519/web3 dependencies stay out of
|
|
6639
6639
|
// the main bundle for data-only apps. Specifier is a static string literal
|
|
6640
6640
|
// so bundle-splitting can see it.
|
|
6641
|
-
const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-
|
|
6641
|
+
const provider = new (await Promise.resolve().then(function () { return require('./guest-auth-provider-DkX8cQqr.js'); })).GuestAuthProvider();
|
|
6642
6642
|
setAuthLoading(true); // reflect "signing in…" while the guest keypair session is minted
|
|
6643
6643
|
// adoptSessionProvider awaits only getConfig() (already resolved here) and then
|
|
6644
6644
|
// runs every write - provider/method/config/marker/user - in one synchronous
|
|
@@ -6809,7 +6809,7 @@ function ensureSharedWalletLoginReady() {
|
|
|
6809
6809
|
if (!sharedWalletReady) {
|
|
6810
6810
|
sharedWalletReady = (async () => {
|
|
6811
6811
|
await core.getConfig();
|
|
6812
|
-
await Promise.resolve().then(function () { return require('./injected-wallet-provider-
|
|
6812
|
+
await Promise.resolve().then(function () { return require('./injected-wallet-provider-BroBvwi6.js'); });
|
|
6813
6813
|
})().catch((error) => {
|
|
6814
6814
|
sharedWalletReady = null;
|
|
6815
6815
|
throw error;
|
|
@@ -6914,7 +6914,7 @@ async function loginWithWallet(options) {
|
|
|
6914
6914
|
await ensureSharedWalletLoginReady();
|
|
6915
6915
|
else
|
|
6916
6916
|
await ensureWalletLoginReady();
|
|
6917
|
-
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-
|
|
6917
|
+
const { InjectedWalletProvider } = await Promise.resolve().then(function () { return require('./injected-wallet-provider-BroBvwi6.js'); });
|
|
6918
6918
|
// Keep the RAW wallet provider: the offchain wrapper forwards only a fixed
|
|
6919
6919
|
// set of methods, so cleanup below must speak to the provider that actually
|
|
6920
6920
|
// holds the config rather than to whatever is wrapping it.
|
|
@@ -10795,6 +10795,129 @@ async function onramp(options = {}) {
|
|
|
10795
10795
|
return Object.assign(Object.assign({}, base), { status: 'closed' });
|
|
10796
10796
|
}
|
|
10797
10797
|
|
|
10798
|
+
// Connections: the signed-in user proves they own an account on another service
|
|
10799
|
+
// (X today) and Bounded records it for THIS app at `__connections__/<userId>`.
|
|
10800
|
+
// Policy rules read it, e.g. `get(/__connections__/@user.id).xHandle`; only the
|
|
10801
|
+
// platform can write it, and only after the provider's own consent screen.
|
|
10802
|
+
//
|
|
10803
|
+
// await connect('x') // leaves the page for X's consent screen
|
|
10804
|
+
// const done = await completeConnection() // on the page X sent the user back to
|
|
10805
|
+
// const { x } = await getConnections() // { id, handle, imageUrl, linkedAt } | null
|
|
10806
|
+
// await disconnect('x')
|
|
10807
|
+
//
|
|
10808
|
+
// Only identity is kept: the provider token is discarded after one profile read.
|
|
10809
|
+
// The return page must be on an origin that serves this app (its bounded.page or
|
|
10810
|
+
// custom domain, or an origin the owner registered, such as localhost).
|
|
10811
|
+
/** `code` is the platform's error code, e.g. `cancelled`, `x_link_expired`, `connection_return_origin_not_allowed`. */
|
|
10812
|
+
class ConnectionError extends Error {
|
|
10813
|
+
constructor(code) {
|
|
10814
|
+
super(`Connection failed: ${code}`);
|
|
10815
|
+
this.code = code;
|
|
10816
|
+
this.name = 'ConnectionError';
|
|
10817
|
+
}
|
|
10818
|
+
}
|
|
10819
|
+
const RETURN_PARAMS = ['x_link', 'x_link_error'];
|
|
10820
|
+
async function request(path, init) {
|
|
10821
|
+
var _a;
|
|
10822
|
+
const base = (_a = (await core.getConfig()).devApiUrl) === null || _a === void 0 ? void 0 : _a.replace(/\/$/, '');
|
|
10823
|
+
if (!base)
|
|
10824
|
+
throw new ConnectionError('connection_unavailable');
|
|
10825
|
+
const generation = await core.getSessionGeneration(false);
|
|
10826
|
+
let token = await core.getFreshAuthToken(false);
|
|
10827
|
+
if (!token)
|
|
10828
|
+
throw new ConnectionError('connection_sign_in_required');
|
|
10829
|
+
const send = (bearer) => fetch(`${base}${path}`, Object.assign({ method: init.method, headers: Object.assign({ Authorization: `Bearer ${bearer}` }, (init.body === undefined ? {} : { 'Content-Type': 'application/json' })) }, (init.body === undefined ? {} : { body: JSON.stringify(init.body) })));
|
|
10830
|
+
let response = await send(token);
|
|
10831
|
+
if (response.status === 401) {
|
|
10832
|
+
// Retry once with a refreshed token, never under a different login.
|
|
10833
|
+
token = await core.getFreshAuthToken(false, { force: true });
|
|
10834
|
+
if (!token || await core.getSessionGeneration(false) !== generation)
|
|
10835
|
+
throw new ConnectionError('connection_sign_in_required');
|
|
10836
|
+
response = await send(token);
|
|
10837
|
+
}
|
|
10838
|
+
const data = await response.json().catch(() => null);
|
|
10839
|
+
if (!response.ok || (data === null || data === void 0 ? void 0 : data.ok) !== true) {
|
|
10840
|
+
throw new ConnectionError(typeof (data === null || data === void 0 ? void 0 : data.error) === 'string' ? data.error : 'connection_unavailable');
|
|
10841
|
+
}
|
|
10842
|
+
return data;
|
|
10843
|
+
}
|
|
10844
|
+
function parseConnection(raw) {
|
|
10845
|
+
if (!raw || typeof raw !== 'object')
|
|
10846
|
+
return null;
|
|
10847
|
+
const value = raw;
|
|
10848
|
+
if (typeof value.id !== 'string' || typeof value.handle !== 'string' || !Number.isSafeInteger(value.linkedAt))
|
|
10849
|
+
return null;
|
|
10850
|
+
return {
|
|
10851
|
+
id: value.id,
|
|
10852
|
+
handle: value.handle,
|
|
10853
|
+
imageUrl: typeof value.imageUrl === 'string' ? value.imageUrl : null,
|
|
10854
|
+
linkedAt: value.linkedAt,
|
|
10855
|
+
};
|
|
10856
|
+
}
|
|
10857
|
+
function assertProvider(provider) {
|
|
10858
|
+
if (provider !== 'x')
|
|
10859
|
+
throw new ConnectionError('connection_provider_unsupported');
|
|
10860
|
+
}
|
|
10861
|
+
/** The signed-in user's linked accounts for this app. */
|
|
10862
|
+
async function getConnections() {
|
|
10863
|
+
var _a;
|
|
10864
|
+
const data = await request('/connections', { method: 'GET' });
|
|
10865
|
+
const connections = ((_a = data.connections) !== null && _a !== void 0 ? _a : {});
|
|
10866
|
+
return { x: parseConnection(connections.x) };
|
|
10867
|
+
}
|
|
10868
|
+
/**
|
|
10869
|
+
* Send the user to the provider's consent screen. They come back to `returnUrl`
|
|
10870
|
+
* (default: this page), where `completeConnection()` finishes the link.
|
|
10871
|
+
*/
|
|
10872
|
+
async function connect(provider, options = {}) {
|
|
10873
|
+
var _a;
|
|
10874
|
+
assertProvider(provider);
|
|
10875
|
+
if (typeof window === 'undefined')
|
|
10876
|
+
throw new ConnectionError('connection_requires_browser');
|
|
10877
|
+
const returnUrl = new URL((_a = options.returnUrl) !== null && _a !== void 0 ? _a : window.location.href, window.location.href);
|
|
10878
|
+
for (const key of RETURN_PARAMS)
|
|
10879
|
+
returnUrl.searchParams.delete(key);
|
|
10880
|
+
const data = await request(`/connections/${provider}/start`, { method: 'POST', body: { returnUrl: returnUrl.href } });
|
|
10881
|
+
const target = typeof data.authorizationUrl === 'string' ? new URL(data.authorizationUrl) : null;
|
|
10882
|
+
if (!target || target.origin !== 'https://x.com')
|
|
10883
|
+
throw new ConnectionError('connection_unavailable');
|
|
10884
|
+
window.location.assign(target.href);
|
|
10885
|
+
}
|
|
10886
|
+
/**
|
|
10887
|
+
* Finish a link on the page the provider returned to. Returns null when this page is
|
|
10888
|
+
* not a connection return; throws ConnectionError when the user cancelled or it failed.
|
|
10889
|
+
* Call it once the user is signed in. The return parameters leave the address bar on
|
|
10890
|
+
* success or cancellation; after another failure they stay, so calling again retries.
|
|
10891
|
+
*/
|
|
10892
|
+
async function completeConnection() {
|
|
10893
|
+
if (typeof window === 'undefined')
|
|
10894
|
+
return null;
|
|
10895
|
+
const url = new URL(window.location.href);
|
|
10896
|
+
const token = url.searchParams.get('x_link');
|
|
10897
|
+
const error = url.searchParams.get('x_link_error');
|
|
10898
|
+
if (token === null && error === null)
|
|
10899
|
+
return null;
|
|
10900
|
+
const clear = () => {
|
|
10901
|
+
for (const key of RETURN_PARAMS)
|
|
10902
|
+
url.searchParams.delete(key);
|
|
10903
|
+
window.history.replaceState(window.history.state, '', url.href);
|
|
10904
|
+
};
|
|
10905
|
+
if (error !== null || !token) {
|
|
10906
|
+
clear();
|
|
10907
|
+
throw new ConnectionError(error || 'failed');
|
|
10908
|
+
}
|
|
10909
|
+
// Keep the return token in the address bar until the platform accepts it, so a
|
|
10910
|
+
// sign-in still loading or a transient failure can retry by calling this again.
|
|
10911
|
+
const data = await request('/connections/x/complete', { method: 'POST', body: { state: token } });
|
|
10912
|
+
clear();
|
|
10913
|
+
return { provider: 'x', connection: parseConnection(data.connection) };
|
|
10914
|
+
}
|
|
10915
|
+
/** Remove the user's linked account for this app. */
|
|
10916
|
+
async function disconnect(provider) {
|
|
10917
|
+
assertProvider(provider);
|
|
10918
|
+
await request(`/connections/${provider}`, { method: 'DELETE' });
|
|
10919
|
+
}
|
|
10920
|
+
|
|
10798
10921
|
// venue-escrow.ts - fund and dispute a venue escrow from inside an OpenApps app (VENUE-GRANT-DESIGN.md).
|
|
10799
10922
|
//
|
|
10800
10923
|
// An OpenApps app's escrow lives in its venue (`agentescrows/<rootAppId>/e/<escrowId>`), and this
|
|
@@ -12153,6 +12276,7 @@ exports.BUILD_DELEGATED_REVIEW_CAPABILITY_SCHEMA = BUILD_DELEGATED_REVIEW_CAPABI
|
|
|
12153
12276
|
exports.BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA = BUILD_REVIEW_CAPABILITY_REFRESH_SCHEMA;
|
|
12154
12277
|
exports.BUILD_REVIEW_CAPABILITY_SCHEMA = BUILD_REVIEW_CAPABILITY_SCHEMA;
|
|
12155
12278
|
exports.BuildsApiError = BuildsApiError;
|
|
12279
|
+
exports.ConnectionError = ConnectionError;
|
|
12156
12280
|
exports.FAILURE_REASONS = FAILURE_REASONS;
|
|
12157
12281
|
exports.NON_TERMINAL_STATES = NON_TERMINAL_STATES;
|
|
12158
12282
|
exports.OffchainAuthProvider = OffchainAuthProvider;
|
|
@@ -12167,12 +12291,15 @@ exports.apps = apps;
|
|
|
12167
12291
|
exports.bs58 = bs58;
|
|
12168
12292
|
exports.bufferExports = bufferExports;
|
|
12169
12293
|
exports.builds = builds;
|
|
12294
|
+
exports.completeConnection = completeConnection;
|
|
12170
12295
|
exports.completeLoginFromRedirect = completeLoginFromRedirect;
|
|
12171
12296
|
exports.confirmAndCheckTransaction = confirmAndCheckTransaction;
|
|
12297
|
+
exports.connect = connect;
|
|
12172
12298
|
exports.connectBroadcast = connectBroadcast;
|
|
12173
12299
|
exports.connectServiceSession = connectServiceSession;
|
|
12174
12300
|
exports.defaultInjectedEvmProvider = defaultInjectedEvmProvider;
|
|
12175
12301
|
exports.defaultInjectedProvider = defaultInjectedProvider;
|
|
12302
|
+
exports.disconnect = disconnect;
|
|
12176
12303
|
exports.disputeVenueEscrow = disputeVenueEscrow;
|
|
12177
12304
|
exports.ensureSharedWalletLoginReady = ensureSharedWalletLoginReady;
|
|
12178
12305
|
exports.ensureSignedIn = ensureSignedIn;
|
|
@@ -12181,6 +12308,7 @@ exports.firstStandardWalletProvider = firstStandardWalletProvider;
|
|
|
12181
12308
|
exports.fundVenueEscrow = fundVenueEscrow;
|
|
12182
12309
|
exports.getAuthLoading = getAuthLoading;
|
|
12183
12310
|
exports.getAuthProvider = getAuthProvider;
|
|
12311
|
+
exports.getConnections = getConnections;
|
|
12184
12312
|
exports.getCurrentUser = getCurrentUser;
|
|
12185
12313
|
exports.getIdToken = getIdToken;
|
|
12186
12314
|
exports.getLoginReturnError = getLoginReturnError;
|
|
@@ -12226,4 +12354,4 @@ exports.useAuth = useAuth;
|
|
|
12226
12354
|
exports.useBuildRun = useBuildRun;
|
|
12227
12355
|
exports.useQuery = useQuery;
|
|
12228
12356
|
exports.waitForAuthReady = waitForAuthReady;
|
|
12229
|
-
//# sourceMappingURL=index-
|
|
12357
|
+
//# sourceMappingURL=index-DrVV40Si.js.map
|