@pepu-chain/sdk 0.0.0-stage → 0.2.1

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 (244) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +590 -2
  3. package/dist/aa/kernel.cjs +41 -0
  4. package/dist/aa/kernel.cjs.map +1 -0
  5. package/dist/aa/kernel.d.cts +88 -0
  6. package/dist/aa/kernel.d.ts +88 -0
  7. package/dist/aa/kernel.guard.js +15 -0
  8. package/dist/aa/kernel.js +11 -0
  9. package/dist/aa/kernel.js.map +1 -0
  10. package/dist/aa/react-direct.cjs +111 -0
  11. package/dist/aa/react-direct.cjs.map +1 -0
  12. package/dist/aa/react-direct.d.cts +42 -0
  13. package/dist/aa/react-direct.d.ts +42 -0
  14. package/dist/aa/react-direct.guard.js +15 -0
  15. package/dist/aa/react-direct.js +107 -0
  16. package/dist/aa/react-direct.js.map +1 -0
  17. package/dist/aa/react.cjs +152 -0
  18. package/dist/aa/react.cjs.map +1 -0
  19. package/dist/aa/react.d.cts +62 -0
  20. package/dist/aa/react.d.ts +62 -0
  21. package/dist/aa/react.guard.js +15 -0
  22. package/dist/aa/react.js +147 -0
  23. package/dist/aa/react.js.map +1 -0
  24. package/dist/aa.cjs +84 -0
  25. package/dist/aa.cjs.map +1 -0
  26. package/dist/aa.d.cts +85 -0
  27. package/dist/aa.d.ts +85 -0
  28. package/dist/aa.js +11 -0
  29. package/dist/aa.js.map +1 -0
  30. package/dist/api-Dz4sCHH_.d.cts +654 -0
  31. package/dist/api-Dz4sCHH_.d.ts +654 -0
  32. package/dist/calls-BRPjKgjl.d.cts +70 -0
  33. package/dist/calls-z_EQOtFb.d.ts +70 -0
  34. package/dist/chains-DK13zGIp.d.cts +235 -0
  35. package/dist/chains-DK13zGIp.d.ts +235 -0
  36. package/dist/chunk-3XUGQODR.js +194 -0
  37. package/dist/chunk-3XUGQODR.js.map +1 -0
  38. package/dist/chunk-45KSZH26.cjs +145 -0
  39. package/dist/chunk-45KSZH26.cjs.map +1 -0
  40. package/dist/chunk-4GINFJO6.cjs +44 -0
  41. package/dist/chunk-4GINFJO6.cjs.map +1 -0
  42. package/dist/chunk-62M2LKQW.js +136 -0
  43. package/dist/chunk-62M2LKQW.js.map +1 -0
  44. package/dist/chunk-6DSZ4Z2N.js +498 -0
  45. package/dist/chunk-6DSZ4Z2N.js.map +1 -0
  46. package/dist/chunk-7MNJF2OB.cjs +72 -0
  47. package/dist/chunk-7MNJF2OB.cjs.map +1 -0
  48. package/dist/chunk-7PVR7QSE.js +45 -0
  49. package/dist/chunk-7PVR7QSE.js.map +1 -0
  50. package/dist/chunk-A5LP2UCS.cjs +2729 -0
  51. package/dist/chunk-A5LP2UCS.cjs.map +1 -0
  52. package/dist/chunk-AJS4UFQX.cjs +121 -0
  53. package/dist/chunk-AJS4UFQX.cjs.map +1 -0
  54. package/dist/chunk-BGALSKAF.cjs +315 -0
  55. package/dist/chunk-BGALSKAF.cjs.map +1 -0
  56. package/dist/chunk-C2XW44FI.cjs +200 -0
  57. package/dist/chunk-C2XW44FI.cjs.map +1 -0
  58. package/dist/chunk-C7IC36XS.cjs +13 -0
  59. package/dist/chunk-C7IC36XS.cjs.map +1 -0
  60. package/dist/chunk-D52PADVY.js +84 -0
  61. package/dist/chunk-D52PADVY.js.map +1 -0
  62. package/dist/chunk-DH6BFNVJ.cjs +272 -0
  63. package/dist/chunk-DH6BFNVJ.cjs.map +1 -0
  64. package/dist/chunk-DPCZJLB3.cjs +87 -0
  65. package/dist/chunk-DPCZJLB3.cjs.map +1 -0
  66. package/dist/chunk-EHBPIYY4.js +262 -0
  67. package/dist/chunk-EHBPIYY4.js.map +1 -0
  68. package/dist/chunk-ESMNAXUI.js +86 -0
  69. package/dist/chunk-ESMNAXUI.js.map +1 -0
  70. package/dist/chunk-F2R473FR.js +304 -0
  71. package/dist/chunk-F2R473FR.js.map +1 -0
  72. package/dist/chunk-IB2FSPMJ.js +66 -0
  73. package/dist/chunk-IB2FSPMJ.js.map +1 -0
  74. package/dist/chunk-IG7RSL2Y.cjs +178 -0
  75. package/dist/chunk-IG7RSL2Y.cjs.map +1 -0
  76. package/dist/chunk-IY3ALPUJ.js +2716 -0
  77. package/dist/chunk-IY3ALPUJ.js.map +1 -0
  78. package/dist/chunk-J3O2ZGG3.cjs +93 -0
  79. package/dist/chunk-J3O2ZGG3.cjs.map +1 -0
  80. package/dist/chunk-J6UXXHBE.js +37 -0
  81. package/dist/chunk-J6UXXHBE.js.map +1 -0
  82. package/dist/chunk-JLZ4LZ4Z.js +22 -0
  83. package/dist/chunk-JLZ4LZ4Z.js.map +1 -0
  84. package/dist/chunk-K7JSQPZO.cjs +231 -0
  85. package/dist/chunk-K7JSQPZO.cjs.map +1 -0
  86. package/dist/chunk-KJYNF5KH.js +224 -0
  87. package/dist/chunk-KJYNF5KH.js.map +1 -0
  88. package/dist/chunk-KVG3AYYR.js +99 -0
  89. package/dist/chunk-KVG3AYYR.js.map +1 -0
  90. package/dist/chunk-NE3QKDOB.cjs +24 -0
  91. package/dist/chunk-NE3QKDOB.cjs.map +1 -0
  92. package/dist/chunk-NVOPDXTA.cjs +95 -0
  93. package/dist/chunk-NVOPDXTA.cjs.map +1 -0
  94. package/dist/chunk-OH3QMAIB.js +11 -0
  95. package/dist/chunk-OH3QMAIB.js.map +1 -0
  96. package/dist/chunk-PHM3ZORG.cjs +110 -0
  97. package/dist/chunk-PHM3ZORG.cjs.map +1 -0
  98. package/dist/chunk-R5PXQNO3.cjs +209 -0
  99. package/dist/chunk-R5PXQNO3.cjs.map +1 -0
  100. package/dist/chunk-RCMKPJZO.cjs +49 -0
  101. package/dist/chunk-RCMKPJZO.cjs.map +1 -0
  102. package/dist/chunk-SVWRRALU.cjs +17 -0
  103. package/dist/chunk-SVWRRALU.cjs.map +1 -0
  104. package/dist/chunk-T43PQXJD.js +202 -0
  105. package/dist/chunk-T43PQXJD.js.map +1 -0
  106. package/dist/chunk-VBH3JLQ5.js +116 -0
  107. package/dist/chunk-VBH3JLQ5.js.map +1 -0
  108. package/dist/chunk-VF3D6KLQ.cjs +94 -0
  109. package/dist/chunk-VF3D6KLQ.cjs.map +1 -0
  110. package/dist/chunk-VTQIHMF3.js +82 -0
  111. package/dist/chunk-VTQIHMF3.js.map +1 -0
  112. package/dist/chunk-W3JN3YIW.js +15 -0
  113. package/dist/chunk-W3JN3YIW.js.map +1 -0
  114. package/dist/chunk-WANILJZQ.cjs +87 -0
  115. package/dist/chunk-WANILJZQ.cjs.map +1 -0
  116. package/dist/chunk-XC4IBCI2.js +86 -0
  117. package/dist/chunk-XC4IBCI2.js.map +1 -0
  118. package/dist/chunk-YKEWWQEJ.js +165 -0
  119. package/dist/chunk-YKEWWQEJ.js.map +1 -0
  120. package/dist/chunk-YQL7NISX.cjs +515 -0
  121. package/dist/chunk-YQL7NISX.cjs.map +1 -0
  122. package/dist/chunk-ZB6SVBK4.js +89 -0
  123. package/dist/chunk-ZB6SVBK4.js.map +1 -0
  124. package/dist/combo/react.cjs +236 -0
  125. package/dist/combo/react.cjs.map +1 -0
  126. package/dist/combo/react.d.cts +148 -0
  127. package/dist/combo/react.d.ts +148 -0
  128. package/dist/combo/react.guard.js +15 -0
  129. package/dist/combo/react.js +230 -0
  130. package/dist/combo/react.js.map +1 -0
  131. package/dist/combo.cjs +263 -0
  132. package/dist/combo.cjs.map +1 -0
  133. package/dist/combo.d.cts +139 -0
  134. package/dist/combo.d.ts +139 -0
  135. package/dist/combo.guard.js +15 -0
  136. package/dist/combo.js +249 -0
  137. package/dist/combo.js.map +1 -0
  138. package/dist/config-CHjz7ZjZ.d.cts +57 -0
  139. package/dist/config-COjhIZTh.d.ts +57 -0
  140. package/dist/doctor.cjs +354 -0
  141. package/dist/doctor.cjs.map +1 -0
  142. package/dist/doctor.d.cts +177 -0
  143. package/dist/doctor.d.ts +177 -0
  144. package/dist/doctor.js +345 -0
  145. package/dist/doctor.js.map +1 -0
  146. package/dist/erc7677-DOW58QBE.d.cts +111 -0
  147. package/dist/erc7677-DOW58QBE.d.ts +111 -0
  148. package/dist/errors-CgX1vNj7.d.cts +100 -0
  149. package/dist/errors-CgX1vNj7.d.ts +100 -0
  150. package/dist/index.cjs +806 -0
  151. package/dist/index.cjs.map +1 -0
  152. package/dist/index.d.cts +2398 -0
  153. package/dist/index.d.ts +2398 -0
  154. package/dist/index.js +559 -0
  155. package/dist/index.js.map +1 -0
  156. package/dist/paymaster/server.cjs +38 -0
  157. package/dist/paymaster/server.cjs.map +1 -0
  158. package/dist/paymaster/server.d.cts +57 -0
  159. package/dist/paymaster/server.d.ts +57 -0
  160. package/dist/paymaster/server.js +36 -0
  161. package/dist/paymaster/server.js.map +1 -0
  162. package/dist/paymaster.cjs +356 -0
  163. package/dist/paymaster.cjs.map +1 -0
  164. package/dist/paymaster.d.cts +1851 -0
  165. package/dist/paymaster.d.ts +1851 -0
  166. package/dist/paymaster.js +289 -0
  167. package/dist/paymaster.js.map +1 -0
  168. package/dist/privy/react.cjs +49 -0
  169. package/dist/privy/react.cjs.map +1 -0
  170. package/dist/privy/react.d.cts +194 -0
  171. package/dist/privy/react.d.ts +194 -0
  172. package/dist/privy/react.guard.js +15 -0
  173. package/dist/privy/react.js +7 -0
  174. package/dist/privy/react.js.map +1 -0
  175. package/dist/privy/server.cjs +44 -0
  176. package/dist/privy/server.cjs.map +1 -0
  177. package/dist/privy/server.d.cts +192 -0
  178. package/dist/privy/server.d.ts +192 -0
  179. package/dist/privy/server.guard.js +15 -0
  180. package/dist/privy/server.js +6 -0
  181. package/dist/privy/server.js.map +1 -0
  182. package/dist/privy/wagmi.d.ts +90 -0
  183. package/dist/privy/wagmi.guard.js +15 -0
  184. package/dist/privy/wagmi.js +55 -0
  185. package/dist/privy/wagmi.js.map +1 -0
  186. package/dist/privy.cjs +34 -0
  187. package/dist/privy.cjs.map +1 -0
  188. package/dist/privy.d.cts +4 -0
  189. package/dist/privy.d.ts +4 -0
  190. package/dist/privy.js +5 -0
  191. package/dist/privy.js.map +1 -0
  192. package/dist/react.cjs +73 -0
  193. package/dist/react.cjs.map +1 -0
  194. package/dist/react.d.cts +66 -0
  195. package/dist/react.d.ts +66 -0
  196. package/dist/react.guard.js +15 -0
  197. package/dist/react.js +68 -0
  198. package/dist/react.js.map +1 -0
  199. package/dist/requirements-C-QiJkL9.d.cts +134 -0
  200. package/dist/requirements-C-QiJkL9.d.ts +134 -0
  201. package/dist/scope-DBRkN7bR.d.cts +94 -0
  202. package/dist/scope-DBRkN7bR.d.ts +94 -0
  203. package/dist/server.cjs +59 -0
  204. package/dist/server.cjs.map +1 -0
  205. package/dist/server.d.cts +208 -0
  206. package/dist/server.d.ts +208 -0
  207. package/dist/server.js +8 -0
  208. package/dist/server.js.map +1 -0
  209. package/dist/session/kernel.cjs +83 -0
  210. package/dist/session/kernel.cjs.map +1 -0
  211. package/dist/session/kernel.d.cts +131 -0
  212. package/dist/session/kernel.d.ts +131 -0
  213. package/dist/session/kernel.guard.js +15 -0
  214. package/dist/session/kernel.js +13 -0
  215. package/dist/session/kernel.js.map +1 -0
  216. package/dist/session/react.cjs +38 -0
  217. package/dist/session/react.cjs.map +1 -0
  218. package/dist/session/react.d.cts +119 -0
  219. package/dist/session/react.d.ts +119 -0
  220. package/dist/session/react.guard.js +15 -0
  221. package/dist/session/react.js +8 -0
  222. package/dist/session/react.js.map +1 -0
  223. package/dist/session/server.cjs +268 -0
  224. package/dist/session/server.cjs.map +1 -0
  225. package/dist/session/server.d.cts +151 -0
  226. package/dist/session/server.d.ts +151 -0
  227. package/dist/session/server.guard.js +15 -0
  228. package/dist/session/server.js +252 -0
  229. package/dist/session/server.js.map +1 -0
  230. package/dist/session.cjs +74 -0
  231. package/dist/session.cjs.map +1 -0
  232. package/dist/session.d.cts +3 -0
  233. package/dist/session.d.ts +3 -0
  234. package/dist/session.js +5 -0
  235. package/dist/session.js.map +1 -0
  236. package/dist/status-Dx9zAFo9.d.ts +327 -0
  237. package/dist/status-wgTM26V7.d.cts +327 -0
  238. package/dist/store-CjmLgp9g.d.cts +64 -0
  239. package/dist/store-CjmLgp9g.d.ts +64 -0
  240. package/dist/types-BEEM7WdG.d.cts +25 -0
  241. package/dist/types-BEEM7WdG.d.ts +25 -0
  242. package/dist/types-BilBTDqK.d.cts +27 -0
  243. package/dist/types-BilBTDqK.d.ts +27 -0
  244. package/package.json +245 -3
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Privy requirements table and dashboard check (`@pepu-chain/sdk/privy`).
3
+ * Client-safe: no secrets, no Privy packages. Re-exported from `config.ts`.
4
+ */
5
+ /** Environment variable names the Privy layer reads. Names only, never values. */
6
+ declare const PRIVY_ENV: {
7
+ readonly appId: "NEXT_PUBLIC_PRIVY_APP_ID";
8
+ readonly appSecret: "PRIVY_APP_SECRET";
9
+ readonly authorizationKey: "PRIVY_AUTHORIZATION_KEY";
10
+ readonly keyQuorumId: "NEXT_PUBLIC_PRIVY_KEY_QUORUM_ID";
11
+ };
12
+ /**
13
+ * Accepted fallback names, read only when the canonical {@link PRIVY_ENV} name
14
+ * is empty. The canonical name is what docs, the doctor and error messages use.
15
+ */
16
+ declare const PRIVY_ENV_ALIASES: {
17
+ readonly appId: readonly ["PRIVY_APP_ID"];
18
+ readonly appSecret: readonly [];
19
+ readonly authorizationKey: readonly [];
20
+ readonly keyQuorumId: readonly ["PRIVY_KEY_QUORUM_ID"];
21
+ };
22
+ /**
23
+ * The subset of Privy's public app-config response this SDK looks at. Every
24
+ * field is optional: the endpoint is undocumented, so a missing field means
25
+ * "unknown", never "wrong".
26
+ */
27
+ interface PrivyPublicAppConfig {
28
+ /** Origins the dashboard allows (scheme, host and port). */
29
+ allowed_domains?: string[];
30
+ /** Enabled login methods, e.g. `"google_oauth"`, `"email"`, `"wallet"`. */
31
+ login_methods?: string[];
32
+ embedded_wallet_config?: {
33
+ ethereum?: {
34
+ create_on_login?: string;
35
+ };
36
+ [key: string]: unknown;
37
+ };
38
+ smart_wallet_config?: unknown;
39
+ [key: string]: unknown;
40
+ }
41
+ /** Result of one requirement check. `"unknown"` means it could not be verified. */
42
+ interface PrivyRequirementResult {
43
+ ok: boolean | "unknown";
44
+ detail: string;
45
+ }
46
+ /** One row of {@link PEPU_PRIVY_REQUIREMENTS}. */
47
+ interface PrivyRequirement {
48
+ id: string;
49
+ where: "dashboard" | "env" | "code";
50
+ label: string;
51
+ required: boolean;
52
+ pillars: ("login" | "session" | "sponsor")[];
53
+ /** Only dashboard rows have a check, and it only sees Privy's public app config. */
54
+ check?: (cfg: PrivyPublicAppConfig, ctx: {
55
+ origin?: string;
56
+ }) => PrivyRequirementResult;
57
+ fix: string;
58
+ docsUrl: string;
59
+ }
60
+ /**
61
+ * Everything a PEPU app needs from Privy, as one data table. It feeds the docs,
62
+ * the MCP `pepu_check_privy_config` tool, the CLI `doctor` and in-app notices.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * import { PEPU_PRIVY_REQUIREMENTS } from "@pepu-chain/sdk/privy";
67
+ * const forSessions = PEPU_PRIVY_REQUIREMENTS.filter((r) => r.pillars.includes("session"));
68
+ * ```
69
+ */
70
+ declare const PEPU_PRIVY_REQUIREMENTS: readonly PrivyRequirement[];
71
+ /** One row of a {@link checkPrivyDashboardConfig} result. */
72
+ interface PrivyDashboardCheckItem {
73
+ id: string;
74
+ ok: boolean | "unknown";
75
+ detail: string;
76
+ fix?: string;
77
+ }
78
+ /**
79
+ * Check the Privy dashboard settings that can be read without a secret, by
80
+ * calling the public app-config endpoint the browser SDK itself uses. Best
81
+ * effort and never throws: anything that cannot be verified (network error,
82
+ * non-200, field missing) is reported as `"unknown"`, not as a failure.
83
+ *
84
+ * Only `where: "dashboard"` requirements are returned. Env and code
85
+ * requirements cannot be checked from here.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * import { checkPrivyDashboardConfig } from "@pepu-chain/sdk/privy";
90
+ * const r = await checkPrivyDashboardConfig({ appId: "cl...", origin: "http://localhost:3001" });
91
+ * for (const i of r.items.filter((i) => i.ok === false)) console.log(i.id, i.fix);
92
+ * ```
93
+ */
94
+ declare function checkPrivyDashboardConfig(o: {
95
+ appId: string;
96
+ origin?: string;
97
+ fetch?: typeof fetch;
98
+ }): Promise<{
99
+ ok: boolean;
100
+ items: PrivyDashboardCheckItem[];
101
+ }>;
102
+ /**
103
+ * Structurally identical to `DoctorCheck` in `@pepu-chain/sdk/doctor`
104
+ * (defined locally so `/privy` does not import `/doctor`).
105
+ */
106
+ interface PrivyDoctorCheck {
107
+ id: string;
108
+ status: "pass" | "fail" | "warn" | "skip";
109
+ message: string;
110
+ fix?: string;
111
+ }
112
+ /**
113
+ * Adapter matching `PrivyDashboardChecker` from `@pepu-chain/sdk/doctor`, so the
114
+ * doctor can run the Privy dashboard checks: pass it as the doctor's injected
115
+ * checker. Unknown keys fail, env and code rows are skipped (the doctor's env
116
+ * check covers them), and anything Privy did not report is a warning, not a
117
+ * failure. `appSecret` is accepted for signature compatibility and never used
118
+ * or logged. Messages contain no URLs or values.
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * import { privyDashboardChecker } from "@pepu-chain/sdk/privy";
123
+ * const checks = await privyDashboardChecker({ appId, requirementKeys: ["login-methods"], fetch });
124
+ * ```
125
+ */
126
+ declare function privyDashboardChecker(input: {
127
+ appId: string;
128
+ requirementKeys: string[];
129
+ appSecret?: string;
130
+ fetch: typeof fetch;
131
+ origin?: string;
132
+ }): Promise<PrivyDoctorCheck[]>;
133
+
134
+ export { PEPU_PRIVY_REQUIREMENTS as P, PRIVY_ENV as a, PRIVY_ENV_ALIASES as b, type PrivyDashboardCheckItem as c, type PrivyDoctorCheck as d, type PrivyPublicAppConfig as e, type PrivyRequirement as f, type PrivyRequirementResult as g, checkPrivyDashboardConfig as h, privyDashboardChecker as p };
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Privy requirements table and dashboard check (`@pepu-chain/sdk/privy`).
3
+ * Client-safe: no secrets, no Privy packages. Re-exported from `config.ts`.
4
+ */
5
+ /** Environment variable names the Privy layer reads. Names only, never values. */
6
+ declare const PRIVY_ENV: {
7
+ readonly appId: "NEXT_PUBLIC_PRIVY_APP_ID";
8
+ readonly appSecret: "PRIVY_APP_SECRET";
9
+ readonly authorizationKey: "PRIVY_AUTHORIZATION_KEY";
10
+ readonly keyQuorumId: "NEXT_PUBLIC_PRIVY_KEY_QUORUM_ID";
11
+ };
12
+ /**
13
+ * Accepted fallback names, read only when the canonical {@link PRIVY_ENV} name
14
+ * is empty. The canonical name is what docs, the doctor and error messages use.
15
+ */
16
+ declare const PRIVY_ENV_ALIASES: {
17
+ readonly appId: readonly ["PRIVY_APP_ID"];
18
+ readonly appSecret: readonly [];
19
+ readonly authorizationKey: readonly [];
20
+ readonly keyQuorumId: readonly ["PRIVY_KEY_QUORUM_ID"];
21
+ };
22
+ /**
23
+ * The subset of Privy's public app-config response this SDK looks at. Every
24
+ * field is optional: the endpoint is undocumented, so a missing field means
25
+ * "unknown", never "wrong".
26
+ */
27
+ interface PrivyPublicAppConfig {
28
+ /** Origins the dashboard allows (scheme, host and port). */
29
+ allowed_domains?: string[];
30
+ /** Enabled login methods, e.g. `"google_oauth"`, `"email"`, `"wallet"`. */
31
+ login_methods?: string[];
32
+ embedded_wallet_config?: {
33
+ ethereum?: {
34
+ create_on_login?: string;
35
+ };
36
+ [key: string]: unknown;
37
+ };
38
+ smart_wallet_config?: unknown;
39
+ [key: string]: unknown;
40
+ }
41
+ /** Result of one requirement check. `"unknown"` means it could not be verified. */
42
+ interface PrivyRequirementResult {
43
+ ok: boolean | "unknown";
44
+ detail: string;
45
+ }
46
+ /** One row of {@link PEPU_PRIVY_REQUIREMENTS}. */
47
+ interface PrivyRequirement {
48
+ id: string;
49
+ where: "dashboard" | "env" | "code";
50
+ label: string;
51
+ required: boolean;
52
+ pillars: ("login" | "session" | "sponsor")[];
53
+ /** Only dashboard rows have a check, and it only sees Privy's public app config. */
54
+ check?: (cfg: PrivyPublicAppConfig, ctx: {
55
+ origin?: string;
56
+ }) => PrivyRequirementResult;
57
+ fix: string;
58
+ docsUrl: string;
59
+ }
60
+ /**
61
+ * Everything a PEPU app needs from Privy, as one data table. It feeds the docs,
62
+ * the MCP `pepu_check_privy_config` tool, the CLI `doctor` and in-app notices.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * import { PEPU_PRIVY_REQUIREMENTS } from "@pepu-chain/sdk/privy";
67
+ * const forSessions = PEPU_PRIVY_REQUIREMENTS.filter((r) => r.pillars.includes("session"));
68
+ * ```
69
+ */
70
+ declare const PEPU_PRIVY_REQUIREMENTS: readonly PrivyRequirement[];
71
+ /** One row of a {@link checkPrivyDashboardConfig} result. */
72
+ interface PrivyDashboardCheckItem {
73
+ id: string;
74
+ ok: boolean | "unknown";
75
+ detail: string;
76
+ fix?: string;
77
+ }
78
+ /**
79
+ * Check the Privy dashboard settings that can be read without a secret, by
80
+ * calling the public app-config endpoint the browser SDK itself uses. Best
81
+ * effort and never throws: anything that cannot be verified (network error,
82
+ * non-200, field missing) is reported as `"unknown"`, not as a failure.
83
+ *
84
+ * Only `where: "dashboard"` requirements are returned. Env and code
85
+ * requirements cannot be checked from here.
86
+ *
87
+ * @example
88
+ * ```ts
89
+ * import { checkPrivyDashboardConfig } from "@pepu-chain/sdk/privy";
90
+ * const r = await checkPrivyDashboardConfig({ appId: "cl...", origin: "http://localhost:3001" });
91
+ * for (const i of r.items.filter((i) => i.ok === false)) console.log(i.id, i.fix);
92
+ * ```
93
+ */
94
+ declare function checkPrivyDashboardConfig(o: {
95
+ appId: string;
96
+ origin?: string;
97
+ fetch?: typeof fetch;
98
+ }): Promise<{
99
+ ok: boolean;
100
+ items: PrivyDashboardCheckItem[];
101
+ }>;
102
+ /**
103
+ * Structurally identical to `DoctorCheck` in `@pepu-chain/sdk/doctor`
104
+ * (defined locally so `/privy` does not import `/doctor`).
105
+ */
106
+ interface PrivyDoctorCheck {
107
+ id: string;
108
+ status: "pass" | "fail" | "warn" | "skip";
109
+ message: string;
110
+ fix?: string;
111
+ }
112
+ /**
113
+ * Adapter matching `PrivyDashboardChecker` from `@pepu-chain/sdk/doctor`, so the
114
+ * doctor can run the Privy dashboard checks: pass it as the doctor's injected
115
+ * checker. Unknown keys fail, env and code rows are skipped (the doctor's env
116
+ * check covers them), and anything Privy did not report is a warning, not a
117
+ * failure. `appSecret` is accepted for signature compatibility and never used
118
+ * or logged. Messages contain no URLs or values.
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * import { privyDashboardChecker } from "@pepu-chain/sdk/privy";
123
+ * const checks = await privyDashboardChecker({ appId, requirementKeys: ["login-methods"], fetch });
124
+ * ```
125
+ */
126
+ declare function privyDashboardChecker(input: {
127
+ appId: string;
128
+ requirementKeys: string[];
129
+ appSecret?: string;
130
+ fetch: typeof fetch;
131
+ origin?: string;
132
+ }): Promise<PrivyDoctorCheck[]>;
133
+
134
+ export { PEPU_PRIVY_REQUIREMENTS as P, PRIVY_ENV as a, PRIVY_ENV_ALIASES as b, type PrivyDashboardCheckItem as c, type PrivyDoctorCheck as d, type PrivyPublicAppConfig as e, type PrivyRequirement as f, type PrivyRequirementResult as g, checkPrivyDashboardConfig as h, privyDashboardChecker as p };
@@ -0,0 +1,94 @@
1
+ import { Address, Hex, Abi } from 'viem';
2
+
3
+ /**
4
+ * Pure Kernel session helpers (scope types, consent-screen data, call-in-scope
5
+ * check, approval parsing). They need only `viem`, so they load without any
6
+ * `@zerodev/*` peer. Also re-exported from `@pepu-chain/sdk/session/kernel`.
7
+ */
8
+ /** One function a session may call on one contract. */
9
+ interface KernelSessionCall {
10
+ target: Address;
11
+ abi: Abi;
12
+ functionName: string;
13
+ /** Max native value per call, in wei. Default `0n`. */
14
+ valueLimit?: bigint;
15
+ }
16
+ /** What a Kernel session allows, as plain data for a consent screen. */
17
+ interface KernelSessionScope {
18
+ calls: {
19
+ target: Address;
20
+ functionName: string;
21
+ /** e.g. `tap()`. */
22
+ signature: string;
23
+ selector: Hex;
24
+ /** Max value per call in wei, as a decimal string. */
25
+ maxValueWei: string;
26
+ }[];
27
+ validAfter: number;
28
+ validUntil: number;
29
+ }
30
+ /**
31
+ * Consent-screen data: each allowed call with its selector, the value limit
32
+ * and the expiry. Pure.
33
+ *
34
+ * @example
35
+ * const scope = describeKernelSessionScope({ calls, validUntil });
36
+ * scope.calls[0]?.signature; // "tap()"
37
+ */
38
+ declare function describeKernelSessionScope(p: {
39
+ calls: readonly KernelSessionCall[];
40
+ validUntil: number;
41
+ validAfter?: number;
42
+ }): KernelSessionScope;
43
+ /**
44
+ * True when `call` (target plus 4-byte selector, value) is inside `scope`.
45
+ * Used server-side to fail fast before sponsoring; the chain still enforces
46
+ * the real limit. Pure.
47
+ *
48
+ * @example
49
+ * isCallInScope(scope, { to, data, value: 0n });
50
+ */
51
+ declare function isCallInScope(scope: Pick<KernelSessionScope, "calls">, call: {
52
+ to: Address;
53
+ data: Hex;
54
+ value?: bigint;
55
+ }): boolean;
56
+ /** Parsed fields of an `approval` string. */
57
+ interface ParsedApproval {
58
+ permissionId: string | null;
59
+ accountAddress: string | null;
60
+ isPreInstalled: boolean | null;
61
+ hasPrivateKey: boolean;
62
+ }
63
+ /**
64
+ * Parse a serialized approval (base64 JSON from `serializePermissionAccount`)
65
+ * without trusting it. Returns `null` when it is not an approval at all.
66
+ *
67
+ * @example
68
+ * parseApproval(approval)?.permissionId;
69
+ */
70
+ declare function parseApproval(approval: string): ParsedApproval | null;
71
+ /** Result of {@link checkApproval}. */
72
+ type ApprovalCheck = {
73
+ ok: true;
74
+ } | {
75
+ ok: false;
76
+ reason: string;
77
+ };
78
+ /**
79
+ * Check a browser-supplied approval before the server stores it. It rejects a
80
+ * payload that carries a private key, is not an enable-mode grant, is for
81
+ * another account, or whose permission id differs from the one this server
82
+ * issued (so scope, session key or expiry changed). The approval is untrusted
83
+ * input; the chain enforces the real limits regardless.
84
+ *
85
+ * @example
86
+ * const check = checkApproval(approval, { kernelAddress, permissionId });
87
+ * if (!check.ok) console.log(check.reason);
88
+ */
89
+ declare function checkApproval(approval: string, expected: {
90
+ kernelAddress: Address;
91
+ permissionId: string;
92
+ }): ApprovalCheck;
93
+
94
+ export { type ApprovalCheck as A, type KernelSessionCall as K, type ParsedApproval as P, type KernelSessionScope as a, checkApproval as c, describeKernelSessionScope as d, isCallInScope as i, parseApproval as p };
@@ -0,0 +1,94 @@
1
+ import { Address, Hex, Abi } from 'viem';
2
+
3
+ /**
4
+ * Pure Kernel session helpers (scope types, consent-screen data, call-in-scope
5
+ * check, approval parsing). They need only `viem`, so they load without any
6
+ * `@zerodev/*` peer. Also re-exported from `@pepu-chain/sdk/session/kernel`.
7
+ */
8
+ /** One function a session may call on one contract. */
9
+ interface KernelSessionCall {
10
+ target: Address;
11
+ abi: Abi;
12
+ functionName: string;
13
+ /** Max native value per call, in wei. Default `0n`. */
14
+ valueLimit?: bigint;
15
+ }
16
+ /** What a Kernel session allows, as plain data for a consent screen. */
17
+ interface KernelSessionScope {
18
+ calls: {
19
+ target: Address;
20
+ functionName: string;
21
+ /** e.g. `tap()`. */
22
+ signature: string;
23
+ selector: Hex;
24
+ /** Max value per call in wei, as a decimal string. */
25
+ maxValueWei: string;
26
+ }[];
27
+ validAfter: number;
28
+ validUntil: number;
29
+ }
30
+ /**
31
+ * Consent-screen data: each allowed call with its selector, the value limit
32
+ * and the expiry. Pure.
33
+ *
34
+ * @example
35
+ * const scope = describeKernelSessionScope({ calls, validUntil });
36
+ * scope.calls[0]?.signature; // "tap()"
37
+ */
38
+ declare function describeKernelSessionScope(p: {
39
+ calls: readonly KernelSessionCall[];
40
+ validUntil: number;
41
+ validAfter?: number;
42
+ }): KernelSessionScope;
43
+ /**
44
+ * True when `call` (target plus 4-byte selector, value) is inside `scope`.
45
+ * Used server-side to fail fast before sponsoring; the chain still enforces
46
+ * the real limit. Pure.
47
+ *
48
+ * @example
49
+ * isCallInScope(scope, { to, data, value: 0n });
50
+ */
51
+ declare function isCallInScope(scope: Pick<KernelSessionScope, "calls">, call: {
52
+ to: Address;
53
+ data: Hex;
54
+ value?: bigint;
55
+ }): boolean;
56
+ /** Parsed fields of an `approval` string. */
57
+ interface ParsedApproval {
58
+ permissionId: string | null;
59
+ accountAddress: string | null;
60
+ isPreInstalled: boolean | null;
61
+ hasPrivateKey: boolean;
62
+ }
63
+ /**
64
+ * Parse a serialized approval (base64 JSON from `serializePermissionAccount`)
65
+ * without trusting it. Returns `null` when it is not an approval at all.
66
+ *
67
+ * @example
68
+ * parseApproval(approval)?.permissionId;
69
+ */
70
+ declare function parseApproval(approval: string): ParsedApproval | null;
71
+ /** Result of {@link checkApproval}. */
72
+ type ApprovalCheck = {
73
+ ok: true;
74
+ } | {
75
+ ok: false;
76
+ reason: string;
77
+ };
78
+ /**
79
+ * Check a browser-supplied approval before the server stores it. It rejects a
80
+ * payload that carries a private key, is not an enable-mode grant, is for
81
+ * another account, or whose permission id differs from the one this server
82
+ * issued (so scope, session key or expiry changed). The approval is untrusted
83
+ * input; the chain enforces the real limits regardless.
84
+ *
85
+ * @example
86
+ * const check = checkApproval(approval, { kernelAddress, permissionId });
87
+ * if (!check.ok) console.log(check.reason);
88
+ */
89
+ declare function checkApproval(approval: string, expected: {
90
+ kernelAddress: Address;
91
+ permissionId: string;
92
+ }): ApprovalCheck;
93
+
94
+ export { type ApprovalCheck as A, type KernelSessionCall as K, type ParsedApproval as P, type KernelSessionScope as a, checkApproval as c, describeKernelSessionScope as d, isCallInScope as i, parseApproval as p };
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ var chunkSVWRRALU_cjs = require('./chunk-SVWRRALU.cjs');
4
+ var chunkIG7RSL2Y_cjs = require('./chunk-IG7RSL2Y.cjs');
5
+ require('./chunk-YQL7NISX.cjs');
6
+
7
+ // src/server.ts
8
+ chunkSVWRRALU_cjs.assertServerOnly("@pepu-chain/sdk/server");
9
+
10
+ Object.defineProperty(exports, "DEFAULT_SESSION_MINUTES", {
11
+ enumerable: true,
12
+ get: function () { return chunkIG7RSL2Y_cjs.DEFAULT_SESSION_MINUTES; }
13
+ });
14
+ Object.defineProperty(exports, "MAX_SESSION_MINUTES", {
15
+ enumerable: true,
16
+ get: function () { return chunkIG7RSL2Y_cjs.MAX_SESSION_MINUTES; }
17
+ });
18
+ Object.defineProperty(exports, "PRIVY_POLICY_NAME_MAX_LENGTH", {
19
+ enumerable: true,
20
+ get: function () { return chunkIG7RSL2Y_cjs.PRIVY_POLICY_NAME_MAX_LENGTH; }
21
+ });
22
+ Object.defineProperty(exports, "SESSION_TRUST_NOTICE", {
23
+ enumerable: true,
24
+ get: function () { return chunkIG7RSL2Y_cjs.SESSION_TRUST_NOTICE; }
25
+ });
26
+ Object.defineProperty(exports, "assertWithinPolicyNameLimit", {
27
+ enumerable: true,
28
+ get: function () { return chunkIG7RSL2Y_cjs.assertWithinPolicyNameLimit; }
29
+ });
30
+ Object.defineProperty(exports, "broadcastSignedTransaction", {
31
+ enumerable: true,
32
+ get: function () { return chunkIG7RSL2Y_cjs.broadcastSignedTransaction; }
33
+ });
34
+ Object.defineProperty(exports, "buildSessionPolicy", {
35
+ enumerable: true,
36
+ get: function () { return chunkIG7RSL2Y_cjs.buildSessionPolicy; }
37
+ });
38
+ Object.defineProperty(exports, "describeSessionScope", {
39
+ enumerable: true,
40
+ get: function () { return chunkIG7RSL2Y_cjs.describeSessionScope; }
41
+ });
42
+ Object.defineProperty(exports, "resolveSessionMinutes", {
43
+ enumerable: true,
44
+ get: function () { return chunkIG7RSL2Y_cjs.resolveSessionMinutes; }
45
+ });
46
+ Object.defineProperty(exports, "sessionExpiry", {
47
+ enumerable: true,
48
+ get: function () { return chunkIG7RSL2Y_cjs.sessionExpiry; }
49
+ });
50
+ Object.defineProperty(exports, "signAndBroadcast", {
51
+ enumerable: true,
52
+ get: function () { return chunkIG7RSL2Y_cjs.signAndBroadcast; }
53
+ });
54
+ Object.defineProperty(exports, "withGasLimitBuffer", {
55
+ enumerable: true,
56
+ get: function () { return chunkIG7RSL2Y_cjs.withGasLimitBuffer; }
57
+ });
58
+ //# sourceMappingURL=server.cjs.map
59
+ //# sourceMappingURL=server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server.ts"],"names":["assertServerOnly"],"mappings":";;;;;;;AAEAA,kCAAA,CAAiB,wBAAwB,CAAA","file":"server.cjs","sourcesContent":["import { assertServerOnly } from \"./internal/assert-server.js\";\n\nassertServerOnly(\"@pepu-chain/sdk/server\");\n\n/**\n * `@pepu-chain/sdk/server` is kept as a stable import path. It re-exports the\n * pure server-side helpers, which now live in `./session/policy.ts`. New\n * server code lives in `/privy/server`, `/session/server` and\n * `/paymaster/server`.\n */\nexport * from \"./session/policy.js\";\n"]}