{"version":3,"file":"solana-message-BGkYFU3C.mjs","sources":["../.rollup-tmp/utils/sol/solana-message.js"],"sourcesContent":["import { getConfig } from \"../../client/config\";\n// NOTE: this message text must stay BYTE-IDENTICAL to what the wallet-auth\n// verifier reconstructs — any drift breaks every SIWS login.\nexport async function genSolanaMessage(address, nonce, appIdOverride) {\n    var _a, _b;\n    /*  Domain / origin aren't available server-side – fall back to envs\n        or simple placeholders.  */\n    const domain = (typeof process !== 'undefined' && ((_a = process.env) === null || _a === void 0 ? void 0 : _a.SESSION_DOMAIN)) || \"server\";\n    const origin = (typeof process !== 'undefined' && ((_b = process.env) === null || _b === void 0 ? void 0 : _b.SESSION_ORIGIN)) || \"server\";\n    // SECURITY (audit-4 CRITICAL-1): bind the signed prompt to the target app.\n    // A server wallet client passes its snapshotted appId (appIdOverride) so the\n    // signed \"App ID\" stays bound to the app the wallet client was created against\n    // even after a later global init() (CTA-05); the default path reads the SAME\n    // global config that genAuthNonce + /session use, so the signed \"App ID\" is\n    // guaranteed to equal the app the session is minted for; the server verifier\n    // rejects any mismatch.\n    const appId = appIdOverride !== null && appIdOverride !== void 0 ? appIdOverride : (await getConfig()).appId;\n    const statement = \"Sign this message to authenticate with our application.\";\n    const currentDate = new Date();\n    const issuedAt = currentDate.toISOString();\n    const expirationTime = new Date(currentDate.getTime() + 5 * 60 * 1000).toISOString();\n    return `${statement}\\n\\n` +\n        `Wallet address:\\n${address}\\n\\n` +\n        `App ID: ${appId}\\n` +\n        `Domain: ${domain}\\n` +\n        `Origin: ${origin}\\n` +\n        `Nonce: ${nonce}\\n` +\n        `Issued At: ${issuedAt}\\n` +\n        `Expiration Time: ${expirationTime}`;\n}\n"],"names":[],"mappings":";;;;;AACA;AACA;AACO,eAAe,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE;AACtE,IAAI,IAAI,EAAE,EAAE,EAAE;AACd;AACA;AACA,IAAI,MAAM,MAAM,GAAG,CAAC,OAAO,OAAO,KAAK,WAAW,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