@bounded-sh/core 0.0.42 → 0.0.46

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.
Files changed (39) hide show
  1. package/dist/client/config.d.ts +20 -1
  2. package/dist/client/operations.d.ts +7 -2
  3. package/dist/client/solana-operations.d.ts +9 -0
  4. package/dist/index-Bq2Zug5X.mjs +8159 -0
  5. package/dist/index-Bq2Zug5X.mjs.map +1 -0
  6. package/dist/index-Kn7IIh5d.js +8231 -0
  7. package/dist/index-Kn7IIh5d.js.map +1 -0
  8. package/dist/index.d.ts +8 -3
  9. package/dist/index.js +78 -7970
  10. package/dist/index.js.map +1 -1
  11. package/dist/index.mjs +5 -7890
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/{realtime-store-Ck_VgTcv.js → realtime-store-DssTn6Nr.js} +3 -5
  14. package/dist/{realtime-store-Ck_VgTcv.js.map → realtime-store-DssTn6Nr.js.map} +1 -1
  15. package/dist/{realtime-store-D3t7PyZl.mjs → realtime-store-XKFKDJRA.mjs} +3 -5
  16. package/dist/{realtime-store-D3t7PyZl.mjs.map → realtime-store-XKFKDJRA.mjs.map} +1 -1
  17. package/dist/sol-utils-D0Tdlpsc.mjs +243 -0
  18. package/dist/sol-utils-D0Tdlpsc.mjs.map +1 -0
  19. package/dist/sol-utils-pVrt7VOx.js +246 -0
  20. package/dist/sol-utils-pVrt7VOx.js.map +1 -0
  21. package/dist/solana-message-DSkrhvy8.js +37 -0
  22. package/dist/solana-message-DSkrhvy8.js.map +1 -0
  23. package/dist/solana-message-Svo0_paO.mjs +35 -0
  24. package/dist/solana-message-Svo0_paO.mjs.map +1 -0
  25. package/dist/solana-operations-4MGSdS1U.mjs +255 -0
  26. package/dist/solana-operations-4MGSdS1U.mjs.map +1 -0
  27. package/dist/solana-operations-C_aie1aF.js +258 -0
  28. package/dist/solana-operations-C_aie1aF.js.map +1 -0
  29. package/dist/types.d.ts +31 -7
  30. package/dist/utils/api.d.ts +1 -0
  31. package/dist/utils/auth-api.d.ts +10 -1
  32. package/dist/utils/evm/evm-transaction-validation.d.ts +46 -0
  33. package/dist/utils/evm/evm-utils.d.ts +40 -0
  34. package/dist/utils/server-session-manager.d.ts +8 -1
  35. package/dist/utils/sol/sol-accessors.d.ts +29 -0
  36. package/dist/utils/sol/sol-utils.d.ts +3 -9
  37. package/dist/utils/sol/solana-message.d.ts +1 -0
  38. package/dist/utils/utils.d.ts +3 -1
  39. package/package.json +3 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"solana-operations-C_aie1aF.js","sources":["../.rollup-tmp/client/solana-operations.js"],"sourcesContent":["import { Buffer } from 'buffer';\nimport { getConfig } from './config';\nconst BOUNDED_PROGRAM_MAINNET = ['poof', '4b5pk1L9tmThvBmaABjcyjfhFGbMbQP5BXk2QZp'].join('');\nconst BOUNDED_PROGRAM_DEVNET = ['taro', '6CvKqwrYrDc16ufYgzQ2NZcyyVKStffbtudrhRu'].join('');\nconst COMPUTE_BUDGET_PROGRAM = 'ComputeBudget111111111111111111111111111111';\nconst SYSTEM_PROGRAM_ID = '11111111111111111111111111111111';\nconst ALLOWED_SERVER_TX_PROGRAMS = new Set([\n BOUNDED_PROGRAM_MAINNET,\n BOUNDED_PROGRAM_DEVNET,\n COMPUTE_BUDGET_PROGRAM,\n SYSTEM_PROGRAM_ID,\n]);\nconst SET_DOCUMENTS_DISCRIMINATOR = '79,46,72,73,24,79,66,245';\nconst SET_DOCUMENTS_V2_DISCRIMINATOR = '22,236,242,185,145,61,26,39';\nconst ALLOWED_BOUNDED_SET_DISCRIMINATORS = new Set([\n SET_DOCUMENTS_DISCRIMINATOR,\n SET_DOCUMENTS_V2_DISCRIMINATOR,\n]);\nclass BorshCursor {\n constructor(data, offset, label) {\n this.data = data;\n this.offset = offset;\n this.label = label;\n }\n requireBytes(length, field) {\n if (this.offset + length > this.data.length) {\n throw new Error(`${this.label} has malformed Bounded instruction data while reading ${field}`);\n }\n }\n readU8(field) { this.requireBytes(1, field); return this.data[this.offset++]; }\n readU32(field) {\n this.requireBytes(4, field);\n const value = this.data[this.offset] | (this.data[this.offset + 1] << 8) |\n (this.data[this.offset + 2] << 16) | (this.data[this.offset + 3] << 24);\n this.offset += 4;\n return value >>> 0;\n }\n skip(length, field) { this.requireBytes(length, field); this.offset += length; }\n readString(field) {\n const length = this.readU32(`${field} length`);\n this.requireBytes(length, field);\n const raw = this.data.slice(this.offset, this.offset + length);\n this.offset += length;\n return Buffer.from(raw).toString('utf8');\n }\n skipBytes(field) { this.skip(this.readU32(`${field} length`), field); }\n isAtEnd() { return this.offset === this.data.length; }\n}\nfunction skipBoundedFieldValue(cursor) {\n const option = cursor.readU8('operation value option');\n if (option === 0)\n return;\n if (option !== 1)\n throw new Error('Server transaction has malformed Bounded field value option');\n const variant = cursor.readU8('operation value variant');\n if (variant === 0 || variant === 1)\n cursor.skip(8, 'operation numeric value');\n else if (variant === 2)\n cursor.skip(1, 'operation bool value');\n else if (variant === 3)\n cursor.readString('operation string value');\n else if (variant === 4)\n cursor.skip(32, 'operation address value');\n else\n throw new Error(`Server transaction has unsupported Bounded field value variant: ${variant}`);\n}\nfunction normalizeOnchainPath(path) {\n let normalized = path.startsWith('/') ? path.slice(1) : path;\n if (normalized.endsWith('*') && normalized.length > 1)\n normalized = normalized.slice(0, -1);\n if (normalized.endsWith('/'))\n normalized = normalized.slice(0, -1);\n return normalized;\n}\nfunction parseBoundedSetDocumentsInstruction(data, label) {\n if (data.length < 8)\n throw new Error(`${label} has malformed Bounded instruction data`);\n const discriminator = Array.from(data.slice(0, 8)).join(',');\n if (!ALLOWED_BOUNDED_SET_DISCRIMINATORS.has(discriminator)) {\n throw new Error(`${label} contains unsupported Bounded instruction`);\n }\n const isV2 = discriminator === SET_DOCUMENTS_V2_DISCRIMINATOR;\n const cursor = new BorshCursor(data, 8, label);\n const appId = cursor.readString('appId');\n const documentPaths = [];\n const documentCount = cursor.readU32('documents length');\n for (let i = 0; i < documentCount; i++) {\n documentPaths.push(normalizeOnchainPath(cursor.readString('document path')));\n const operationCount = cursor.readU32('operations length');\n for (let j = 0; j < operationCount; j++) {\n cursor.readString('operation key');\n skipBoundedFieldValue(cursor);\n cursor.skip(1, 'operation kind');\n }\n }\n const deletePaths = [];\n const deleteCount = cursor.readU32('delete paths length');\n for (let i = 0; i < deleteCount; i++)\n deletePaths.push(normalizeOnchainPath(cursor.readString('delete path')));\n const txDataCount = cursor.readU32('txData length');\n for (let i = 0; i < txDataCount; i++) {\n cursor.readString('txData plugin function key');\n cursor.skipBytes('txData bytes');\n if (isV2)\n cursor.skipBytes('txData raIndices');\n else\n cursor.skip(cursor.readU32('txData raIndices length') * 8, 'txData raIndices');\n }\n const simulate = cursor.readU8('simulate');\n if (simulate !== 0 && simulate !== 1)\n throw new Error(`${label} has malformed Bounded simulate flag`);\n if (!cursor.isAtEnd())\n throw new Error(`${label} has trailing Bounded instruction data`);\n return { appId, documentPaths, deletePaths };\n}\nfunction assertSamePathSet(label, expectedPaths, actualPaths) {\n const expected = new Set(expectedPaths.map(normalizeOnchainPath).filter(Boolean));\n const actual = new Set(actualPaths.map(normalizeOnchainPath).filter(Boolean));\n const missing = [...expected].filter(path => !actual.has(path));\n const extra = [...actual].filter(path => !expected.has(path));\n if (missing.length || extra.length) {\n const details = [missing.length ? `missing paths: ${missing.join(', ')}` : '', extra.length ? `unexpected paths: ${extra.join(', ')}` : '']\n .filter(Boolean).join('; ');\n throw new Error(`${label} Bounded instruction paths do not match requested write paths (${details})`);\n }\n}\nfunction deserializeAndValidateServerTransaction(serializedTransaction, VersionedTransactionClass, options) {\n var _a;\n const transaction = VersionedTransactionClass.deserialize(Buffer.from(serializedTransaction, 'base64'));\n const { label, expectedAppId, expectedWritePaths } = options;\n const accountKeys = transaction.message.staticAccountKeys;\n let boundedInstructionCount = 0;\n const actualWritePaths = [];\n for (const ix of transaction.message.compiledInstructions) {\n if (ix.programIdIndex >= accountKeys.length)\n throw new Error(`${label} has program ID in lookup table (not allowed)`);\n const programId = accountKeys[ix.programIdIndex].toBase58();\n if (!ALLOWED_SERVER_TX_PROGRAMS.has(programId))\n throw new Error(`${label} contains unauthorized program: ${programId}`);\n const data = ix.data instanceof Uint8Array ? ix.data : Buffer.from((_a = ix.data) !== null && _a !== void 0 ? _a : []);\n if (programId === SYSTEM_PROGRAM_ID)\n throw new Error(`${label} contains unauthorized System Program instruction`);\n if (programId === BOUNDED_PROGRAM_MAINNET || programId === BOUNDED_PROGRAM_DEVNET) {\n boundedInstructionCount++;\n const parsed = parseBoundedSetDocumentsInstruction(data, label);\n if (parsed.appId !== expectedAppId)\n throw new Error(`${label} Bounded instruction appId does not match configured appId`);\n actualWritePaths.push(...parsed.documentPaths, ...parsed.deletePaths);\n }\n }\n if (boundedInstructionCount !== 1)\n throw new Error(`${label} must contain exactly one Bounded set-documents instruction`);\n assertSamePathSet(label, expectedWritePaths, actualWritePaths);\n return transaction;\n}\nfunction isHexString(value) {\n if (typeof value !== 'string')\n return false;\n const testValue = value.startsWith('-') ? value.slice(1) : value;\n return /^(0x)?[0-9a-fA-F]+$/.test(testValue);\n}\nexport async function handleSolanaTransaction(tx, authProvider, options, expectedWritePaths) {\n var _a, _b, _c, _d, _e;\n const chainSdk = await import(\"@solana/web3.js\");\n const { PublicKey, SystemProgram, TransactionInstruction, VersionedTransaction } = chainSdk;\n const solTransactionData = {\n remainingAccounts: tx.remainingAccounts,\n setDocumentData: tx.transactionArgs.setDocumentData,\n deletePaths: tx.transactionArgs.deletePaths,\n idl: tx.idl,\n txData: (_b = (_a = tx.txData) === null || _a === void 0 ? void 0 : _a.map((txData) => ({\n pluginFunctionKey: txData.pluginFunctionKey,\n txData: Buffer.from(txData.txData),\n raIndices: (() => {\n const raw = txData.raIndices;\n if (raw == null)\n return Buffer.alloc(0);\n if (Buffer.isBuffer(raw))\n return raw;\n if (raw instanceof Uint8Array)\n return Buffer.from(raw);\n const arrayLike = Array.isArray(raw) ? raw :\n raw && typeof raw === 'object' && Array.isArray(raw.data) ? raw.data :\n (() => { throw new Error(`raIndices has unexpected shape: ${typeof raw}`); })();\n return Buffer.from(arrayLike.map((raIndex) => {\n const value = isHexString(raIndex) ? parseInt(raIndex, 16) : Number(raIndex);\n if (!Number.isInteger(value) || value < 0 || value > 255) {\n throw new Error(`raIndex ${raIndex} is not a valid u8 (must be integer in 0..255)`);\n }\n return value;\n }));\n })(),\n }))) !== null && _b !== void 0 ? _b : [],\n };\n const config = await getConfig();\n if (tx.signedTransaction) {\n deserializeAndValidateServerTransaction(tx.signedTransaction, VersionedTransaction, {\n label: 'Server signedTransaction', expectedAppId: config.appId, expectedWritePaths,\n });\n }\n const solTransaction = {\n appId: config.appId,\n txArgs: [solTransactionData],\n lutKey: (_c = tx.lutAddress) !== null && _c !== void 0 ? _c : null,\n additionalLutAddresses: tx.additionalLutAddresses,\n network: tx.network,\n preInstructions: (_e = (_d = tx.preInstructions) === null || _d === void 0 ? void 0 : _d.map((ix, index) => {\n var _a;\n const keys = (_a = ix.keys) === null || _a === void 0 ? void 0 : _a.map((key) => ({ pubkey: new PublicKey(key.pubkey), isSigner: key.isSigner, isWritable: key.isWritable }));\n const programId = ix.programId === SYSTEM_PROGRAM_ID ? SystemProgram.programId : new PublicKey(ix.programId);\n const instruction = new TransactionInstruction({ keys, programId, data: Buffer.from(ix.data) });\n if (instruction.programId.equals(SystemProgram.programId)) {\n throw new Error(`Server preInstruction[${index}] contains unauthorized System Program preInstruction`);\n }\n return instruction;\n })) !== null && _e !== void 0 ? _e : [],\n signedTransaction: tx.signedTransaction,\n };\n return authProvider.runTransaction(undefined, solTransaction, options);\n}\nexport async function handlePreBuiltTransaction(tx, authProvider, options, expectedWritePaths) {\n var _a, _b, _c;\n const { Connection, VersionedTransaction } = await import(\"@solana/web3.js\");\n const config = await getConfig();\n const transaction = deserializeAndValidateServerTransaction(tx.serializedTransaction, VersionedTransaction, {\n label: 'Pre-built transaction', expectedAppId: config.appId, expectedWritePaths,\n });\n const shouldSubmit = (options === null || options === void 0 ? void 0 : options.shouldSubmitTx) !== false;\n const rpcUrl = (_a = config.rpcUrl) === null || _a === void 0 ? void 0 : _a.trim();\n if (shouldSubmit && !rpcUrl)\n throw new Error(`Pre-built Solana transaction submission requires init({ rpcUrl }) for ${tx.network}`);\n const signedTx = await authProvider.signTransaction(transaction);\n const rawTx = signedTx.serialize();\n if (!shouldSubmit) {\n return { transactionSignature: '', signedTransaction: Buffer.from(rawTx).toString('base64'), blockNumber: 0, gasUsed: '0' };\n }\n const connection = new Connection(rpcUrl, 'confirmed');\n const signature = await connection.sendRawTransaction(rawTx, { skipPreflight: false, maxRetries: 3 });\n const confirmation = await connection.confirmTransaction({\n signature, blockhash: tx.blockhash, lastValidBlockHeight: tx.lastValidBlockHeight,\n }, 'confirmed');\n return {\n transactionSignature: signature,\n signedTransaction: Buffer.from(rawTx).toString('base64'),\n blockNumber: (_c = (_b = confirmation.context) === null || _b === void 0 ? void 0 : _b.slot) !== null && _c !== void 0 ? _c : 0,\n gasUsed: '0',\n };\n}\n"],"names":["Buffer","getConfig","index"],"mappings":";;;;;;;;AAEA,MAAM,uBAAuB,GAAG,CAAC,MAAM,EAAE,yCAAyC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC5F,MAAM,sBAAsB,GAAG,CAAC,MAAM,EAAE,yCAAyC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3F,MAAM,sBAAsB,GAAG,6CAA6C;AAC5E,MAAM,iBAAiB,GAAG,kCAAkC;AAC5D,MAAM,0BAA0B,GAAG,IAAI,GAAG,CAAC;AAC3C,IAAI,uBAAuB;AAC3B,IAAI,sBAAsB;AAC1B,IAAI,sBAAsB;AAC1B,IAAI,iBAAiB;AACrB,CAAC,CAAC;AACF,MAAM,2BAA2B,GAAG,0BAA0B;AAC9D,MAAM,8BAA8B,GAAG,6BAA6B;AACpE,MAAM,kCAAkC,GAAG,IAAI,GAAG,CAAC;AACnD,IAAI,2BAA2B;AAC/B,IAAI,8BAA8B;AAClC,CAAC,CA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AAoB;AACzF,KAAK,EAAE,WAAW,CAAC;AACnB,IAAI,OAAO;AACX,QAAQ,oBAAoB,EAAE,SAAS;AACvC,QAAQ,iBAAiB,EAAEA,0BAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;AAChE,QAAQ,WAAW,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,YAAY,CAAC,OAAO,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,MAAM,GAAG,EAAE,CAAC,IAAI,MAAM,IAAI,IAAI,EAAE,KAAK,MAAM,GAAG,EAAE,GAAG,CAAC;AACvI,QAAQ,OAAO,EAAE,GAAG;AACpB,KAAK;AACL;;;;;"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { PublicKey, TransactionInstruction, Transaction, VersionedTransaction } from "@solana/web3.js";
2
- import { SetOptions } from "./client/operations";
1
+ import type { PublicKey, TransactionInstruction, Transaction, VersionedTransaction } from "@solana/web3.js";
2
+ import type { SetOptions } from "./client/operations";
3
3
  export interface AuthProvider {
4
4
  login(): Promise<User | null>;
5
5
  runTransaction(evmTransactionData?: EVMTransaction, solTransactionData?: SolTransaction, options?: SetOptions): Promise<TransactionResult>;
@@ -56,14 +56,38 @@ export interface User {
56
56
  * prompt. `false`/absent for real (email/social/wallet) logins.
57
57
  */
58
58
  isAnonymous?: boolean;
59
+ /**
60
+ * REAL onchain EVM wallet address (resolves @user.evmAddress). Present for EVM
61
+ * wallet/SIWE logins; `null`/absent for Solana-wallet and email-only logins
62
+ * that haven't linked an EVM wallet. Canonical LOWERCASE 0x-hex — the identity
63
+ * layer matches case-sensitively, so it is normalized at the boundary. Derived
64
+ * from the idToken's `custom:evmWalletAddress` claim. For EVM wallet logins
65
+ * `id === evmAddress` and `address` (the Solana wallet) is null.
66
+ */
67
+ evmAddress?: string | null;
59
68
  provider: AuthProvider;
60
69
  }
61
70
  export interface EVMTransaction {
62
- contractAddress: string;
63
- contractAbi: string | any;
64
- functionName: string;
65
- value: string;
66
- txArgs: any[];
71
+ contractAddress?: string;
72
+ contractAbi?: string | any;
73
+ functionName?: string;
74
+ txArgs?: any[];
75
+ /** Target contract (the per-chain BoundedRuntime address). */
76
+ to?: string;
77
+ /** ABI-encoded calldata (setDocuments(...)). */
78
+ data?: string;
79
+ /** Wei value to send with the call, as a decimal or 0x-hex string. Default "0". */
80
+ value?: string;
81
+ /** EIP-155 chain id the tx must execute on (used for the chain-switch guard). */
82
+ chainId?: number;
83
+ /** Optional gas limit hint (the worker's eth_estimateGas ×1.2). */
84
+ gas?: string;
85
+ /** Optional EIP-1559 max fee per gas. */
86
+ maxFeePerGas?: string;
87
+ /** Optional EIP-1559 max priority fee per gas. */
88
+ maxPriorityFeePerGas?: string;
89
+ /** Optional nonce; normally omitted so the signing wallet fills it. */
90
+ nonce?: number;
67
91
  }
68
92
  export interface SolTransaction {
69
93
  appId: string;
@@ -3,4 +3,5 @@ export declare function makeApiRequest(method: string, urlPath: string, data?: a
3
3
  _getAuthHeaders?: () => Promise<Record<string, string>>;
4
4
  _clearAuth?: () => Promise<void>;
5
5
  timeout?: number;
6
+ signal?: AbortSignal;
6
7
  }): Promise<any>;
@@ -1,6 +1,15 @@
1
1
  export declare function genNonce(): Promise<any>;
2
2
  export declare function genAuthNonce(): Promise<any>;
3
- export declare function createSessionWithSignature(address: string, message: string, signature: string): Promise<any>;
3
+ /**
4
+ * Exchange a wallet signature for a Bounded session at the /session issuer.
5
+ *
6
+ * @param authMethodOverride the exact /session discriminator to send (e.g. 'siwe'
7
+ * for the SIWE/EVM path). When omitted the method is derived from config: an
8
+ * aliased method (evm-wallet → siwe) maps through SESSION_METHOD_ALIASES, a
9
+ * Solana wallet/guest method passes through verbatim, and anything else
10
+ * defaults to the canonical 'phantom' the issuer accepts for a signature.
11
+ */
12
+ export declare function createSessionWithSignature(address: string, message: string, signature: string, authMethodOverride?: string): Promise<any>;
4
13
  export declare function refreshSession(refreshToken: string, issuer?: string): Promise<any>;
5
14
  export declare class SessionRevokeError extends Error {
6
15
  readonly cause?: unknown;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Selectors derived from the canonical BoundedRuntime signatures (BoundedTypes.sol):
3
+ *
4
+ * cast sig 'setDocuments(string,(string[],bool,(string,uint8,uint8,bytes)[])[])'
5
+ * => 0x0827b094
6
+ * cast sig 'setDocumentsAttested(string,(string[],bool,(string,uint8,uint8,bytes)[])[],(bytes32,uint256,uint256,uint8,bytes32,bytes32))'
7
+ * => 0x87b111c4
8
+ *
9
+ * Keep the signatures beside the constants: changing either Solidity tuple is an
10
+ * ABI break and must deliberately update these values and the Foundry goldens.
11
+ */
12
+ export declare const BOUNDED_RUNTIME_SET_DOCUMENTS_SELECTOR = "0x0827b094";
13
+ export declare const BOUNDED_RUNTIME_SET_DOCUMENTS_ATTESTED_SELECTOR = "0x87b111c4";
14
+ export interface EvmTransactionPolicy {
15
+ /** A single allowed chain. */
16
+ chainId?: number;
17
+ /** Runtime for `chainId` (single-chain shorthand). */
18
+ runtimeAddress?: string;
19
+ /** Per-chain runtime allowlist for a multi-chain signer. */
20
+ runtimeAddresses?: Record<string, string>;
21
+ }
22
+ /** Minimal structural transaction surface consumed by the canonical validator.
23
+ * Kept local so security-sensitive server/Worker signers do not pull the
24
+ * browser/client type graph merely to validate a prebuilt runtime write. */
25
+ export interface EvmWriteTransaction {
26
+ to?: string;
27
+ data?: string;
28
+ value?: string;
29
+ chainId?: number;
30
+ nonce?: number;
31
+ }
32
+ /**
33
+ * Fail closed unless calldata is a byte-for-byte canonical ABI encoding of one
34
+ * supported BoundedRuntime write. This is the defense used by direct signer
35
+ * surfaces; the higher-level write validator below additionally binds app/ops.
36
+ */
37
+ export declare function assertCanonicalBoundedRuntimeWriteCalldata(rawData: unknown): void;
38
+ /** Verify the untrusted 202 payload is exactly the governed write the app asked for. */
39
+ export declare function assertEvmTransactionMatchesWrite(transaction: EvmWriteTransaction, context: {
40
+ appId: string;
41
+ documents: Array<{
42
+ destinationPath: string;
43
+ document: any;
44
+ }>;
45
+ policy?: EvmTransactionPolicy | null;
46
+ }): void;
@@ -0,0 +1,40 @@
1
+ export interface SiweMessageOptions {
2
+ /**
3
+ * EIP-155 chain id the wallet is connected to. The verifier requires a
4
+ * positive safe integer; write-time chain/runtime policy is enforced
5
+ * separately before transaction signing. Defaults to 1 when unavailable.
6
+ */
7
+ chainId?: number;
8
+ /** Single-line statement (must not contain a newline). Defaults to the canonical prompt. */
9
+ statement?: string;
10
+ /** Issued-at instant. Defaults to now. */
11
+ issuedAt?: Date;
12
+ /** Expiration instant. Defaults to issuedAt + 5 min (inside the issuer's 10-min cap). */
13
+ expirationTime?: Date;
14
+ /** EIP-4361 version; the grammar fixes this at "1". */
15
+ version?: string;
16
+ }
17
+ /**
18
+ * Build the canonical EIP-4361 SIWE message the bounded-auth issuer verifies.
19
+ *
20
+ * @param address the connected EVM account (lowercased into the prompt).
21
+ * @param nonce single-use nonce from genAuthNonce().
22
+ * @param appId the target app id (bound as the sole `bounded:app:<appId>` resource).
23
+ * @param domain RFC-3986 authority of the requesting site (e.g. window.location.host).
24
+ * @param uri the requesting URI; its origin is bound to the domain and actual browser Origin.
25
+ */
26
+ export declare function genSiweMessage(address: string, nonce: string, appId: string, domain: string, uri: string, options?: SiweMessageOptions): string;
27
+ /**
28
+ * Lowercase an EVM address to the canonical identity form. EVM addresses are
29
+ * case-insensitive on-chain but the identity layer (@user.evmAddress) matches
30
+ * case-sensitively, so every boundary normalizes to lowercase. Does not validate
31
+ * shape — use normalizeEvmAddress() when the input is untrusted.
32
+ */
33
+ export declare function toLowerEvmAddress(address: string): string;
34
+ /**
35
+ * Normalize an untrusted EVM address to canonical lowercase 0x-hex, or null when
36
+ * it isn't a well-formed 20-byte hex address. Mirrors the realtime-worker's
37
+ * normalizeEvmAddress (auth.ts) EXACTLY so a client-derived @user.evmAddress and
38
+ * the server-authenticated one are byte-identical (fail-closed on malformed).
39
+ */
40
+ export declare function normalizeEvmAddress(raw: unknown): string | null;
@@ -1,4 +1,4 @@
1
- import { Keypair } from "@solana/web3.js";
1
+ import type { Keypair } from "@solana/web3.js";
2
2
  /**
3
3
  * Server-side SessionManager
4
4
  * --------------------------
@@ -19,12 +19,19 @@ export declare class ServerSessionManager {
19
19
  private session;
20
20
  private pendingSession;
21
21
  private readonly keypair;
22
+ private readonly sessionFactory;
22
23
  private constructor();
23
24
  /**
24
25
  * Create a session manager for a specific keypair.
25
26
  * Each instance has its own independent session cache.
26
27
  */
27
28
  static forKeypair(keypair: Keypair): ServerSessionManager;
29
+ /**
30
+ * Create an isolated server session manager for a non-Solana signer (currently
31
+ * EVM/SIWE). The factory must perform the signature exchange and return the
32
+ * canonical signer address with its tokens; no signer state becomes global.
33
+ */
34
+ static forSessionFactory(factory: () => Promise<ServerSession>): ServerSessionManager;
28
35
  private createSession;
29
36
  getSession(): Promise<ServerSession>;
30
37
  setSession(session: ServerSession): void;
@@ -0,0 +1,29 @@
1
+ import type { Connection, PublicKey, Transaction, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
+ import type { AnchorProvider } from "@coral-xyz/anchor";
3
+ import type { TxData } from "./sol-utils";
4
+ export type RemainingAccount = {
5
+ pubkey: PublicKey;
6
+ isWritable: boolean;
7
+ isSigner: boolean;
8
+ };
9
+ /** Load the Anchor/Web3 transaction builder only when an onchain write uses it. */
10
+ export declare function buildSetDocumentsTransaction(connection: Connection, idl: any, programProvider: AnchorProvider, payerPublicKey: PublicKey, args: {
11
+ app_id: string;
12
+ documents: {
13
+ path: string;
14
+ operations: {
15
+ key: string;
16
+ value: any;
17
+ operation: number;
18
+ }[];
19
+ }[];
20
+ delete_paths: string[];
21
+ txData: TxData[];
22
+ }, remainingAccounts: RemainingAccount[], lutKey: PublicKey | null, preInstructions: TransactionInstruction[], simulate: boolean, additionalLutAddresses?: string[]): Promise<{
23
+ tx: VersionedTransaction | Transaction;
24
+ blockhash: string;
25
+ lastValidBlockHeight: number;
26
+ }>;
27
+ /** SIWS message creation is async already, so its onchain module can be lazy. */
28
+ export declare function genSolanaMessage(address: string, nonce: string): Promise<string>;
29
+ export declare function convertRemainingAccounts(remainingAccounts: any[]): RemainingAccount[];
@@ -1,5 +1,5 @@
1
- import { Connection, PublicKey, Transaction, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
- import * as anchor from "@coral-xyz/anchor";
1
+ import type { Connection, PublicKey, Transaction, TransactionInstruction, VersionedTransaction } from "@solana/web3.js";
2
+ import type { AnchorProvider } from "@coral-xyz/anchor";
3
3
  export type RemainingAccount = {
4
4
  pubkey: PublicKey;
5
5
  isWritable: boolean;
@@ -10,14 +10,8 @@ export type TxData = {
10
10
  txData: Buffer;
11
11
  raIndices: Buffer;
12
12
  };
13
- export declare function genSolanaMessage(address: string, nonce: string): Promise<string>;
14
13
  export declare function isHexString(value: unknown): boolean;
15
- export declare function convertRemainingAccounts(remainingAccounts: any[]): {
16
- pubkey: PublicKey;
17
- isWritable: boolean;
18
- isSigner: boolean;
19
- }[];
20
- export declare function buildSetDocumentsTransaction(connection: Connection, idl: any, anchorProvider: anchor.AnchorProvider, payerPublicKey: PublicKey, args: {
14
+ export declare function buildSetDocumentsTransaction(connection: Connection, idl: any, programProvider: AnchorProvider, payerPublicKey: PublicKey, args: {
21
15
  app_id: string;
22
16
  documents: {
23
17
  path: string;
@@ -0,0 +1 @@
1
+ export declare function genSolanaMessage(address: string, nonce: string): Promise<string>;
@@ -11,10 +11,12 @@ export declare function getUserInfo(isServer: boolean): Promise<any>;
11
11
  export interface UserIdentity {
12
12
  /** @user.id — universal stable identity (custom:userId only). */
13
13
  id: string | null;
14
- /** @user.address — REAL wallet; null for email-only logins. */
14
+ /** @user.address — REAL Solana wallet; null for email-only / EVM-wallet logins. */
15
15
  address: string | null;
16
16
  /** @user.email — verified lowercased email; null for wallet/SIWS logins. */
17
17
  email: string | null;
18
+ /** @user.evmAddress — REAL EVM wallet, canonical lowercase 0x-hex; null when unlinked. */
19
+ evmAddress: string | null;
18
20
  }
19
21
  /**
20
22
  * Derive { id, address, email } from an idToken's claims.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bounded-sh/core",
3
- "version": "0.0.42",
3
+ "version": "0.0.46",
4
4
  "description": "Shared client, data-plane, and transport primitives for Bounded, the full-stack app builder and runtime for AI-built apps: policy-enforced operations, files, functions, and realtime.",
5
5
  "homepage": "https://bounded.sh/docs/sdk",
6
6
  "main": "./dist/index.js",
@@ -16,7 +16,7 @@
16
16
  "scripts": {
17
17
  "build": "rm -rf ./dist ./.rollup-tmp && tsc -p tsconfig.build.json --outDir .rollup-tmp --declarationDir .rollup-tmp --emitDeclarationOnly false && rollup -c && tsc -p tsconfig.build.json --emitDeclarationOnly --declarationDir dist && rm -rf ./.rollup-tmp",
18
18
  "watch": "rollup -c -w",
19
- "test": "node src/client/run-config-network-test.mjs && node src/client/run-read-principal-test.mjs && node src/client/run-principal-collision-test.mjs && node src/client/run-row-shape-test.mjs && node src/client/run-transport-test.mjs && node src/client/run-public-export-surface-test.mjs && node src/client/run-live-auth-test.mjs && node src/client/run-live-view-principal-test.mjs && node src/client/run-subscription-auth-error-test.mjs && node src/client/run-onchain-validation-test.mjs && node src/client/websocket-auth-url.test.mjs",
19
+ "test": "node src/client/run-config-network-test.mjs && node src/client/run-read-principal-test.mjs && node src/client/run-principal-collision-test.mjs && node src/client/run-abortable-read-test.mjs && node src/utils/run-api-abort-test.mjs && node src/utils/run-api-transient-get-retry-test.mjs && node src/client/run-row-shape-test.mjs && node src/client/run-transport-test.mjs && node src/client/run-public-export-surface-test.mjs && node src/client/run-live-auth-test.mjs && node src/client/run-live-view-principal-test.mjs && node src/client/run-subscription-auth-error-test.mjs && node src/client/run-subscription-confirmation-retry-test.mjs && node src/client/subscription-handoff-grace.source.test.mjs && node src/client/run-onchain-validation-test.mjs && node src/client/run-evm-dispatch-test.mjs && node src/utils/evm/run-evm-utils-test.mjs && node src/client/websocket-auth-url.test.mjs",
20
20
  "prepare": "npm run build"
21
21
  },
22
22
  "files": [
@@ -64,4 +64,4 @@
64
64
  "publishConfig": {
65
65
  "access": "public"
66
66
  }
67
- }
67
+ }