@bounded-sh/core 0.0.94 → 0.0.95
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-DM016I43.mjs → index-BDW82Uxu.mjs} +80 -6
- package/dist/index-BDW82Uxu.mjs.map +1 -0
- package/dist/{index-BjLa1c_O.js → index-D-dJjY-Q.js} +85 -5
- package/dist/index-D-dJjY-Q.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{realtime-store-zORqBwjW.mjs → realtime-store-DTS5OLm2.mjs} +2 -2
- package/dist/{realtime-store-zORqBwjW.mjs.map → realtime-store-DTS5OLm2.mjs.map} +1 -1
- package/dist/{realtime-store-O-5CDrGm.js → realtime-store-Dytq73zO.js} +2 -2
- package/dist/{realtime-store-O-5CDrGm.js.map → realtime-store-Dytq73zO.js.map} +1 -1
- package/dist/{solana-message-DY0FVgHp.js → solana-message-Cww3s9HW.js} +2 -2
- package/dist/{solana-message-DY0FVgHp.js.map → solana-message-Cww3s9HW.js.map} +1 -1
- package/dist/{solana-message-CmvedcGr.mjs → solana-message-j1s9osZD.mjs} +2 -2
- package/dist/{solana-message-CmvedcGr.mjs.map → solana-message-j1s9osZD.mjs.map} +1 -1
- package/dist/{solana-operations-DSAWnjWi.js → solana-operations-SR1En23U.js} +3 -3
- package/dist/{solana-operations-DSAWnjWi.js.map → solana-operations-SR1En23U.js.map} +1 -1
- package/dist/{solana-operations-D_e7AMhd.mjs → solana-operations-da26Ject.mjs} +4 -4
- package/dist/{solana-operations-D_e7AMhd.mjs.map → solana-operations-da26Ject.mjs.map} +1 -1
- package/dist/{solana-v1-operations-DF6Cp0IX.mjs → solana-v1-operations-BQQfm-ni.mjs} +3 -3
- package/dist/{solana-v1-operations-DF6Cp0IX.mjs.map → solana-v1-operations-BQQfm-ni.mjs.map} +1 -1
- package/dist/{solana-v1-operations-ByWdgO_7.js → solana-v1-operations-DRm8TzzJ.js} +3 -3
- package/dist/{solana-v1-operations-ByWdgO_7.js.map → solana-v1-operations-DRm8TzzJ.js.map} +1 -1
- package/dist/utils/sol/solana-sign-in-message.d.ts +43 -0
- package/package.json +2 -2
- package/dist/index-BjLa1c_O.js.map +0 -1
- package/dist/index-DM016I43.mjs.map +0 -1
|
@@ -4131,7 +4131,7 @@ class ServerSessionManager {
|
|
|
4131
4131
|
const sessionConfig = (_a = this.sessionConfig) !== null && _a !== void 0 ? _a : undefined;
|
|
4132
4132
|
/* fetch nonce from auth API (bound to the snapshotted app+issuer) */
|
|
4133
4133
|
const nonce = await genAuthNonce(sessionConfig);
|
|
4134
|
-
const { genSolanaMessage } = await import('./solana-message-
|
|
4134
|
+
const { genSolanaMessage } = await import('./solana-message-j1s9osZD.mjs');
|
|
4135
4135
|
const message = await genSolanaMessage(address, nonce, sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.appId);
|
|
4136
4136
|
/* sign the message */
|
|
4137
4137
|
const sigBytes = nacl.sign.detached(new TextEncoder().encode(message), kp.secretKey);
|
|
@@ -6916,7 +6916,7 @@ async function doReconnectWithNewAuth() {
|
|
|
6916
6916
|
console.warn('[WS v2] Failed to clear HTTP read cache on auth change:', error);
|
|
6917
6917
|
}
|
|
6918
6918
|
try {
|
|
6919
|
-
const { reconnectRealtimeStoreWithNewAuth } = await import('./realtime-store-
|
|
6919
|
+
const { reconnectRealtimeStoreWithNewAuth } = await import('./realtime-store-DTS5OLm2.mjs');
|
|
6920
6920
|
await reconnectRealtimeStoreWithNewAuth();
|
|
6921
6921
|
}
|
|
6922
6922
|
catch (error) {
|
|
@@ -8366,7 +8366,7 @@ async function setMany(many, options) {
|
|
|
8366
8366
|
'Nothing was signed or submitted.');
|
|
8367
8367
|
}
|
|
8368
8368
|
const solanaChain = workerChain;
|
|
8369
|
-
const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await import('./solana-operations-
|
|
8369
|
+
const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await import('./solana-operations-da26Ject.mjs');
|
|
8370
8370
|
// OA-0001: derive the expected intent from OUR OWN request (the one
|
|
8371
8371
|
// ground truth a tampered builder response cannot change) so the
|
|
8372
8372
|
// validator can reject any transaction whose operation semantics
|
|
@@ -9851,10 +9851,84 @@ function toMillis(seconds) {
|
|
|
9851
9851
|
|
|
9852
9852
|
/** SIWS message creation is async already, so its onchain module can be lazy. */
|
|
9853
9853
|
async function genSolanaMessage(address, nonce) {
|
|
9854
|
-
const implementation = await import('./solana-message-
|
|
9854
|
+
const implementation = await import('./solana-message-j1s9osZD.mjs');
|
|
9855
9855
|
return implementation.genSolanaMessage(address, nonce);
|
|
9856
9856
|
}
|
|
9857
9857
|
|
|
9858
|
+
// solana-sign-in-message.ts - the Sign In With Solana (SIWS) text the BROWSER lane signs.
|
|
9859
|
+
//
|
|
9860
|
+
// The legacy genSolanaMessage text stamps `Domain: server` / `Origin: server`, so a
|
|
9861
|
+
// signature over it proves who owns the wallet and nothing about which page asked. The
|
|
9862
|
+
// issuer used to compensate with the request's Origin header, which any non-browser client
|
|
9863
|
+
// can forge (SEC-01): an attacker's backend relayed a signature phished on a fake page with
|
|
9864
|
+
// `Origin: https://auth.bounded.sh` and minted the victim's session. The standard SIWS text
|
|
9865
|
+
// carries the requesting page's host in its first line. Bounded leaves that host unset, so a
|
|
9866
|
+
// wallet implementing the Wallet Standard `solana:signIn` feature fills it from the page that
|
|
9867
|
+
// asked (spec-following wallets bind a page-supplied one to that page too), and the issuer
|
|
9868
|
+
// refuses any other host for the request's Origin, so a fake page cannot obtain a signature
|
|
9869
|
+
// that mints for another site. The issuer now
|
|
9870
|
+
// requires this format on every request that carries an Origin header and checks the signed
|
|
9871
|
+
// domain against that header; the legacy text stays for the origin-less lane (CLI keypairs,
|
|
9872
|
+
// the server SDK, React Native, realtime agents).
|
|
9873
|
+
//
|
|
9874
|
+
// The layout is the SIWS ABNF exactly as @solana/wallet-standard-util 1.1.3 emits it
|
|
9875
|
+
// (lib/esm/signIn.js createSignInMessageText, lines 116-175): the domain line, the address,
|
|
9876
|
+
// a blank line, the statement, a blank line, then the present fields in the fixed order
|
|
9877
|
+
// URI, Version, Chain ID, Nonce, Issued At, Expiration Time, Not Before, Request ID,
|
|
9878
|
+
// Resources. A wallet rendering our sign-in request and a guest device key rendering it here
|
|
9879
|
+
// therefore sign byte-identical text for the same fields, and the issuer parses one grammar.
|
|
9880
|
+
const SOLANA_SIGN_IN_STATEMENT = "Sign in to this Bounded app with your Solana wallet.";
|
|
9881
|
+
const SOLANA_SIGN_IN_VERSION = "1";
|
|
9882
|
+
const SOLANA_SIGN_IN_VALIDITY_MS = 5 * 60 * 1000;
|
|
9883
|
+
function createSolanaSignInRequest(appId, nonce, now = Date.now()) {
|
|
9884
|
+
return {
|
|
9885
|
+
statement: SOLANA_SIGN_IN_STATEMENT,
|
|
9886
|
+
version: SOLANA_SIGN_IN_VERSION,
|
|
9887
|
+
nonce,
|
|
9888
|
+
issuedAt: new Date(now).toISOString(),
|
|
9889
|
+
expirationTime: new Date(now + SOLANA_SIGN_IN_VALIDITY_MS).toISOString(),
|
|
9890
|
+
requestId: appId,
|
|
9891
|
+
};
|
|
9892
|
+
}
|
|
9893
|
+
/**
|
|
9894
|
+
* The sign-in request for the app the SDK is configured for. Reads the SAME global config
|
|
9895
|
+
* appId as genAuthNonce and createSessionWithSignature, so the signed app id equals the app
|
|
9896
|
+
* the session is minted for; a snapshotted appIdOverride binds a wallet client created
|
|
9897
|
+
* against another app (the same contract genSolanaMessage keeps).
|
|
9898
|
+
*/
|
|
9899
|
+
async function genSolanaSignInRequest(nonce, appIdOverride) {
|
|
9900
|
+
const appId = appIdOverride !== null && appIdOverride !== void 0 ? appIdOverride : (await getConfig()).appId;
|
|
9901
|
+
return createSolanaSignInRequest(appId, nonce);
|
|
9902
|
+
}
|
|
9903
|
+
function createSolanaSignInMessageText(fields) {
|
|
9904
|
+
return `${fields.domain} wants you to sign in with your Solana account:\n${fields.address}\n\n` +
|
|
9905
|
+
`${fields.statement}\n\n` +
|
|
9906
|
+
`Version: ${fields.version}\n` +
|
|
9907
|
+
`Nonce: ${fields.nonce}\n` +
|
|
9908
|
+
`Issued At: ${fields.issuedAt}\n` +
|
|
9909
|
+
`Expiration Time: ${fields.expirationTime}\n` +
|
|
9910
|
+
`Request ID: ${fields.requestId}`;
|
|
9911
|
+
}
|
|
9912
|
+
/**
|
|
9913
|
+
* The full sign-in text for a signer that is not a wallet (a browser guest device key),
|
|
9914
|
+
* which therefore stamps the page host itself.
|
|
9915
|
+
*/
|
|
9916
|
+
async function genSolanaSignInMessage(address, nonce, domain, appIdOverride) {
|
|
9917
|
+
return createSolanaSignInMessageText(Object.assign(Object.assign({}, (await genSolanaSignInRequest(nonce, appIdOverride))), { domain, address }));
|
|
9918
|
+
}
|
|
9919
|
+
/**
|
|
9920
|
+
* The host a browser page signs in as: `location.host`, the hostname plus any non-default
|
|
9921
|
+
* port, which is exactly what the issuer compares the Origin header's host against. Null
|
|
9922
|
+
* off-browser (Node, React Native), where the caller stays on the origin-less legacy lane.
|
|
9923
|
+
*/
|
|
9924
|
+
function browserSignInDomain() {
|
|
9925
|
+
var _a;
|
|
9926
|
+
if (typeof window === "undefined")
|
|
9927
|
+
return null;
|
|
9928
|
+
const host = (_a = window.location) === null || _a === void 0 ? void 0 : _a.host;
|
|
9929
|
+
return typeof host === "string" && host ? host : null;
|
|
9930
|
+
}
|
|
9931
|
+
|
|
9858
9932
|
// ---------------------------------------------------------------------------
|
|
9859
9933
|
// functions.ts -- Bounded Functions client (the imperative escape hatch).
|
|
9860
9934
|
//
|
|
@@ -10326,5 +10400,5 @@ function defineLiveModule(mod) {
|
|
|
10326
10400
|
return mod;
|
|
10327
10401
|
}
|
|
10328
10402
|
|
|
10329
|
-
export { getIdToken as $, subscribe as A, closeAllSubscriptions as B, clearCache as C, getCachedData as D, reconnectWithNewAuth as E, createClient as F, ScopedClientReadOnlyError as G, subscribeQuery as H, InsufficientBalanceError as I, closeAllQuerySubscriptions as J, canonicalizeArgs as K, canonicalizeResult as L, DEFAULT_QUERY_POLL_INTERVAL_MS as M, MIN_QUERY_POLL_INTERVAL_MS as N, BoundedDeclineError as O, deriveDecline as P, dispatchDeclineEvent as Q, DECLINE_EVENT_NAME as R, SOLANA_MAX_SUPPORTED_TRANSACTION_VERSION as S, dispatchRateLimitEvent as T, RATE_LIMIT_EVENT_NAME as U, hasActiveConnection as V, increment as W, serverTimestamp as X, now as Y, toSeconds as Z, toMillis as _, getTransactionJson as a, deriveUserIdentityFromIdToken as a0, getSessionGeneration as a1, WebSessionManager as a2, ReactNativeSessionManager as a3, getActiveSessionManager as a4, onSessionCleared as a5, SessionEnvironmentError as a6, UNSUPPORTED_ENVIRONMENT_CODE as a7, AUTH_CHANGED_CODE as a8, AUTH_EXPIRED_CODE as a9, isAuthExpiredError as aa, getFreshAuthToken as ab, ServerSessionManager as ac, createSessionWithSignature as ad, refreshSession as ae, revokeSession as af, signSessionCreateMessage as ag, genAuthNonce as ah, genSolanaMessage as ai,
|
|
10330
|
-
//# sourceMappingURL=index-
|
|
10403
|
+
export { getIdToken as $, subscribe as A, closeAllSubscriptions as B, clearCache as C, getCachedData as D, reconnectWithNewAuth as E, createClient as F, ScopedClientReadOnlyError as G, subscribeQuery as H, InsufficientBalanceError as I, closeAllQuerySubscriptions as J, canonicalizeArgs as K, canonicalizeResult as L, DEFAULT_QUERY_POLL_INTERVAL_MS as M, MIN_QUERY_POLL_INTERVAL_MS as N, BoundedDeclineError as O, deriveDecline as P, dispatchDeclineEvent as Q, DECLINE_EVENT_NAME as R, SOLANA_MAX_SUPPORTED_TRANSACTION_VERSION as S, dispatchRateLimitEvent as T, RATE_LIMIT_EVENT_NAME as U, hasActiveConnection as V, increment as W, serverTimestamp as X, now as Y, toSeconds as Z, toMillis as _, getTransactionJson as a, deriveUserIdentityFromIdToken as a0, getSessionGeneration as a1, WebSessionManager as a2, ReactNativeSessionManager as a3, getActiveSessionManager as a4, onSessionCleared as a5, SessionEnvironmentError as a6, UNSUPPORTED_ENVIRONMENT_CODE as a7, AUTH_CHANGED_CODE as a8, AUTH_EXPIRED_CODE as a9, withEffects as aA, isEffectResult as aB, defineLiveModule as aC, EFFECT_INTENT_ADDRESS as aD, isAuthExpiredError as aa, getFreshAuthToken as ab, ServerSessionManager as ac, createSessionWithSignature as ad, refreshSession as ae, revokeSession as af, signSessionCreateMessage as ag, genAuthNonce as ah, genSolanaMessage as ai, createSolanaSignInRequest as aj, createSolanaSignInMessageText as ak, genSolanaSignInRequest as al, genSolanaSignInMessage as am, browserSignInDomain as an, SOLANA_SIGN_IN_STATEMENT as ao, genSiweMessage as ap, normalizeEvmAddress as aq, toLowerEvmAddress as ar, functions as as, invoke as at, FunctionInvokeError as au, live as av, intent as aw, status as ax, subscribeView as ay, LiveIntentError as az, bufferExports as b, getWebhookKeysUrl as c, getConfiguredAppId as d, get as e, getMany as f, getConfig as g, docId as h, init as i, setMany as j, setFile as k, getFiles as l, search as m, runQueryMany as n, runExpression as o, runExpressionMany as p, queryAggregate as q, runQuery as r, set as s, signMessage as t, signTransaction as u, signAndSubmitTransaction as v, count as w, aggregate as x, reconcileSetResult as y, waitForSetResult as z };
|
|
10404
|
+
//# sourceMappingURL=index-BDW82Uxu.mjs.map
|