@bounded-sh/core 0.0.93 → 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
|
@@ -4133,7 +4133,7 @@ class ServerSessionManager {
|
|
|
4133
4133
|
const sessionConfig = (_a = this.sessionConfig) !== null && _a !== void 0 ? _a : undefined;
|
|
4134
4134
|
/* fetch nonce from auth API (bound to the snapshotted app+issuer) */
|
|
4135
4135
|
const nonce = await genAuthNonce(sessionConfig);
|
|
4136
|
-
const { genSolanaMessage } = await Promise.resolve().then(function () { return require('./solana-message-
|
|
4136
|
+
const { genSolanaMessage } = await Promise.resolve().then(function () { return require('./solana-message-Cww3s9HW.js'); });
|
|
4137
4137
|
const message = await genSolanaMessage(address, nonce, sessionConfig === null || sessionConfig === void 0 ? void 0 : sessionConfig.appId);
|
|
4138
4138
|
/* sign the message */
|
|
4139
4139
|
const sigBytes = nacl.sign.detached(new TextEncoder().encode(message), kp.secretKey);
|
|
@@ -6918,7 +6918,7 @@ async function doReconnectWithNewAuth() {
|
|
|
6918
6918
|
console.warn('[WS v2] Failed to clear HTTP read cache on auth change:', error);
|
|
6919
6919
|
}
|
|
6920
6920
|
try {
|
|
6921
|
-
const { reconnectRealtimeStoreWithNewAuth } = await Promise.resolve().then(function () { return require('./realtime-store-
|
|
6921
|
+
const { reconnectRealtimeStoreWithNewAuth } = await Promise.resolve().then(function () { return require('./realtime-store-Dytq73zO.js'); });
|
|
6922
6922
|
await reconnectRealtimeStoreWithNewAuth();
|
|
6923
6923
|
}
|
|
6924
6924
|
catch (error) {
|
|
@@ -8368,7 +8368,7 @@ async function setMany(many, options) {
|
|
|
8368
8368
|
'Nothing was signed or submitted.');
|
|
8369
8369
|
}
|
|
8370
8370
|
const solanaChain = workerChain;
|
|
8371
|
-
const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-
|
|
8371
|
+
const { handlePreBuiltTransaction, buildExpectedWriteIntent } = await Promise.resolve().then(function () { return require('./solana-operations-SR1En23U.js'); });
|
|
8372
8372
|
// OA-0001: derive the expected intent from OUR OWN request (the one
|
|
8373
8373
|
// ground truth a tampered builder response cannot change) so the
|
|
8374
8374
|
// validator can reject any transaction whose operation semantics
|
|
@@ -9853,10 +9853,84 @@ function toMillis(seconds) {
|
|
|
9853
9853
|
|
|
9854
9854
|
/** SIWS message creation is async already, so its onchain module can be lazy. */
|
|
9855
9855
|
async function genSolanaMessage(address, nonce) {
|
|
9856
|
-
const implementation = await Promise.resolve().then(function () { return require('./solana-message-
|
|
9856
|
+
const implementation = await Promise.resolve().then(function () { return require('./solana-message-Cww3s9HW.js'); });
|
|
9857
9857
|
return implementation.genSolanaMessage(address, nonce);
|
|
9858
9858
|
}
|
|
9859
9859
|
|
|
9860
|
+
// solana-sign-in-message.ts - the Sign In With Solana (SIWS) text the BROWSER lane signs.
|
|
9861
|
+
//
|
|
9862
|
+
// The legacy genSolanaMessage text stamps `Domain: server` / `Origin: server`, so a
|
|
9863
|
+
// signature over it proves who owns the wallet and nothing about which page asked. The
|
|
9864
|
+
// issuer used to compensate with the request's Origin header, which any non-browser client
|
|
9865
|
+
// can forge (SEC-01): an attacker's backend relayed a signature phished on a fake page with
|
|
9866
|
+
// `Origin: https://auth.bounded.sh` and minted the victim's session. The standard SIWS text
|
|
9867
|
+
// carries the requesting page's host in its first line. Bounded leaves that host unset, so a
|
|
9868
|
+
// wallet implementing the Wallet Standard `solana:signIn` feature fills it from the page that
|
|
9869
|
+
// asked (spec-following wallets bind a page-supplied one to that page too), and the issuer
|
|
9870
|
+
// refuses any other host for the request's Origin, so a fake page cannot obtain a signature
|
|
9871
|
+
// that mints for another site. The issuer now
|
|
9872
|
+
// requires this format on every request that carries an Origin header and checks the signed
|
|
9873
|
+
// domain against that header; the legacy text stays for the origin-less lane (CLI keypairs,
|
|
9874
|
+
// the server SDK, React Native, realtime agents).
|
|
9875
|
+
//
|
|
9876
|
+
// The layout is the SIWS ABNF exactly as @solana/wallet-standard-util 1.1.3 emits it
|
|
9877
|
+
// (lib/esm/signIn.js createSignInMessageText, lines 116-175): the domain line, the address,
|
|
9878
|
+
// a blank line, the statement, a blank line, then the present fields in the fixed order
|
|
9879
|
+
// URI, Version, Chain ID, Nonce, Issued At, Expiration Time, Not Before, Request ID,
|
|
9880
|
+
// Resources. A wallet rendering our sign-in request and a guest device key rendering it here
|
|
9881
|
+
// therefore sign byte-identical text for the same fields, and the issuer parses one grammar.
|
|
9882
|
+
const SOLANA_SIGN_IN_STATEMENT = "Sign in to this Bounded app with your Solana wallet.";
|
|
9883
|
+
const SOLANA_SIGN_IN_VERSION = "1";
|
|
9884
|
+
const SOLANA_SIGN_IN_VALIDITY_MS = 5 * 60 * 1000;
|
|
9885
|
+
function createSolanaSignInRequest(appId, nonce, now = Date.now()) {
|
|
9886
|
+
return {
|
|
9887
|
+
statement: SOLANA_SIGN_IN_STATEMENT,
|
|
9888
|
+
version: SOLANA_SIGN_IN_VERSION,
|
|
9889
|
+
nonce,
|
|
9890
|
+
issuedAt: new Date(now).toISOString(),
|
|
9891
|
+
expirationTime: new Date(now + SOLANA_SIGN_IN_VALIDITY_MS).toISOString(),
|
|
9892
|
+
requestId: appId,
|
|
9893
|
+
};
|
|
9894
|
+
}
|
|
9895
|
+
/**
|
|
9896
|
+
* The sign-in request for the app the SDK is configured for. Reads the SAME global config
|
|
9897
|
+
* appId as genAuthNonce and createSessionWithSignature, so the signed app id equals the app
|
|
9898
|
+
* the session is minted for; a snapshotted appIdOverride binds a wallet client created
|
|
9899
|
+
* against another app (the same contract genSolanaMessage keeps).
|
|
9900
|
+
*/
|
|
9901
|
+
async function genSolanaSignInRequest(nonce, appIdOverride) {
|
|
9902
|
+
const appId = appIdOverride !== null && appIdOverride !== void 0 ? appIdOverride : (await getConfig()).appId;
|
|
9903
|
+
return createSolanaSignInRequest(appId, nonce);
|
|
9904
|
+
}
|
|
9905
|
+
function createSolanaSignInMessageText(fields) {
|
|
9906
|
+
return `${fields.domain} wants you to sign in with your Solana account:\n${fields.address}\n\n` +
|
|
9907
|
+
`${fields.statement}\n\n` +
|
|
9908
|
+
`Version: ${fields.version}\n` +
|
|
9909
|
+
`Nonce: ${fields.nonce}\n` +
|
|
9910
|
+
`Issued At: ${fields.issuedAt}\n` +
|
|
9911
|
+
`Expiration Time: ${fields.expirationTime}\n` +
|
|
9912
|
+
`Request ID: ${fields.requestId}`;
|
|
9913
|
+
}
|
|
9914
|
+
/**
|
|
9915
|
+
* The full sign-in text for a signer that is not a wallet (a browser guest device key),
|
|
9916
|
+
* which therefore stamps the page host itself.
|
|
9917
|
+
*/
|
|
9918
|
+
async function genSolanaSignInMessage(address, nonce, domain, appIdOverride) {
|
|
9919
|
+
return createSolanaSignInMessageText(Object.assign(Object.assign({}, (await genSolanaSignInRequest(nonce, appIdOverride))), { domain, address }));
|
|
9920
|
+
}
|
|
9921
|
+
/**
|
|
9922
|
+
* The host a browser page signs in as: `location.host`, the hostname plus any non-default
|
|
9923
|
+
* port, which is exactly what the issuer compares the Origin header's host against. Null
|
|
9924
|
+
* off-browser (Node, React Native), where the caller stays on the origin-less legacy lane.
|
|
9925
|
+
*/
|
|
9926
|
+
function browserSignInDomain() {
|
|
9927
|
+
var _a;
|
|
9928
|
+
if (typeof window === "undefined")
|
|
9929
|
+
return null;
|
|
9930
|
+
const host = (_a = window.location) === null || _a === void 0 ? void 0 : _a.host;
|
|
9931
|
+
return typeof host === "string" && host ? host : null;
|
|
9932
|
+
}
|
|
9933
|
+
|
|
9860
9934
|
// ---------------------------------------------------------------------------
|
|
9861
9935
|
// functions.ts -- Bounded Functions client (the imperative escape hatch).
|
|
9862
9936
|
//
|
|
@@ -10341,12 +10415,14 @@ exports.MIN_QUERY_POLL_INTERVAL_MS = MIN_QUERY_POLL_INTERVAL_MS;
|
|
|
10341
10415
|
exports.RATE_LIMIT_EVENT_NAME = RATE_LIMIT_EVENT_NAME;
|
|
10342
10416
|
exports.ReactNativeSessionManager = ReactNativeSessionManager;
|
|
10343
10417
|
exports.SOLANA_MAX_SUPPORTED_TRANSACTION_VERSION = SOLANA_MAX_SUPPORTED_TRANSACTION_VERSION;
|
|
10418
|
+
exports.SOLANA_SIGN_IN_STATEMENT = SOLANA_SIGN_IN_STATEMENT;
|
|
10344
10419
|
exports.ScopedClientReadOnlyError = ScopedClientReadOnlyError;
|
|
10345
10420
|
exports.ServerSessionManager = ServerSessionManager;
|
|
10346
10421
|
exports.SessionEnvironmentError = SessionEnvironmentError;
|
|
10347
10422
|
exports.UNSUPPORTED_ENVIRONMENT_CODE = UNSUPPORTED_ENVIRONMENT_CODE;
|
|
10348
10423
|
exports.WebSessionManager = WebSessionManager;
|
|
10349
10424
|
exports.aggregate = aggregate;
|
|
10425
|
+
exports.browserSignInDomain = browserSignInDomain;
|
|
10350
10426
|
exports.bufferExports = bufferExports;
|
|
10351
10427
|
exports.canonicalizeArgs = canonicalizeArgs;
|
|
10352
10428
|
exports.canonicalizeResult = canonicalizeResult;
|
|
@@ -10356,6 +10432,8 @@ exports.closeAllSubscriptions = closeAllSubscriptions;
|
|
|
10356
10432
|
exports.count = count;
|
|
10357
10433
|
exports.createClient = createClient;
|
|
10358
10434
|
exports.createSessionWithSignature = createSessionWithSignature;
|
|
10435
|
+
exports.createSolanaSignInMessageText = createSolanaSignInMessageText;
|
|
10436
|
+
exports.createSolanaSignInRequest = createSolanaSignInRequest;
|
|
10359
10437
|
exports.defineLiveModule = defineLiveModule;
|
|
10360
10438
|
exports.deriveDecline = deriveDecline;
|
|
10361
10439
|
exports.deriveUserIdentityFromIdToken = deriveUserIdentityFromIdToken;
|
|
@@ -10366,6 +10444,8 @@ exports.functions = functions;
|
|
|
10366
10444
|
exports.genAuthNonce = genAuthNonce;
|
|
10367
10445
|
exports.genSiweMessage = genSiweMessage;
|
|
10368
10446
|
exports.genSolanaMessage = genSolanaMessage;
|
|
10447
|
+
exports.genSolanaSignInMessage = genSolanaSignInMessage;
|
|
10448
|
+
exports.genSolanaSignInRequest = genSolanaSignInRequest;
|
|
10369
10449
|
exports.get = get;
|
|
10370
10450
|
exports.getActiveSessionManager = getActiveSessionManager;
|
|
10371
10451
|
exports.getCachedData = getCachedData;
|
|
@@ -10416,4 +10496,4 @@ exports.toMillis = toMillis;
|
|
|
10416
10496
|
exports.toSeconds = toSeconds;
|
|
10417
10497
|
exports.waitForSetResult = waitForSetResult;
|
|
10418
10498
|
exports.withEffects = withEffects;
|
|
10419
|
-
//# sourceMappingURL=index-
|
|
10499
|
+
//# sourceMappingURL=index-D-dJjY-Q.js.map
|