@pepu-chain/sdk 0.0.0-stage → 0.2.0
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/LICENSE +21 -0
- package/README.md +565 -2
- package/dist/aa/kernel.cjs +40 -0
- package/dist/aa/kernel.cjs.map +1 -0
- package/dist/aa/kernel.d.cts +88 -0
- package/dist/aa/kernel.d.ts +88 -0
- package/dist/aa/kernel.js +11 -0
- package/dist/aa/kernel.js.map +1 -0
- package/dist/aa/react-direct.cjs +110 -0
- package/dist/aa/react-direct.cjs.map +1 -0
- package/dist/aa/react-direct.d.cts +42 -0
- package/dist/aa/react-direct.d.ts +42 -0
- package/dist/aa/react-direct.js +107 -0
- package/dist/aa/react-direct.js.map +1 -0
- package/dist/aa/react.cjs +151 -0
- package/dist/aa/react.cjs.map +1 -0
- package/dist/aa/react.d.cts +62 -0
- package/dist/aa/react.d.ts +62 -0
- package/dist/aa/react.js +147 -0
- package/dist/aa/react.js.map +1 -0
- package/dist/aa.cjs +84 -0
- package/dist/aa.cjs.map +1 -0
- package/dist/aa.d.cts +85 -0
- package/dist/aa.d.ts +85 -0
- package/dist/aa.js +11 -0
- package/dist/aa.js.map +1 -0
- package/dist/api-Dz4sCHH_.d.cts +654 -0
- package/dist/api-Dz4sCHH_.d.ts +654 -0
- package/dist/calls-BRPjKgjl.d.cts +70 -0
- package/dist/calls-z_EQOtFb.d.ts +70 -0
- package/dist/chains-DK13zGIp.d.cts +235 -0
- package/dist/chains-DK13zGIp.d.ts +235 -0
- package/dist/chunk-3XUGQODR.js +194 -0
- package/dist/chunk-3XUGQODR.js.map +1 -0
- package/dist/chunk-45KSZH26.cjs +145 -0
- package/dist/chunk-45KSZH26.cjs.map +1 -0
- package/dist/chunk-4GINFJO6.cjs +44 -0
- package/dist/chunk-4GINFJO6.cjs.map +1 -0
- package/dist/chunk-62M2LKQW.js +136 -0
- package/dist/chunk-62M2LKQW.js.map +1 -0
- package/dist/chunk-6DSZ4Z2N.js +498 -0
- package/dist/chunk-6DSZ4Z2N.js.map +1 -0
- package/dist/chunk-7MNJF2OB.cjs +72 -0
- package/dist/chunk-7MNJF2OB.cjs.map +1 -0
- package/dist/chunk-A5LP2UCS.cjs +2729 -0
- package/dist/chunk-A5LP2UCS.cjs.map +1 -0
- package/dist/chunk-AJS4UFQX.cjs +121 -0
- package/dist/chunk-AJS4UFQX.cjs.map +1 -0
- package/dist/chunk-C2XW44FI.cjs +200 -0
- package/dist/chunk-C2XW44FI.cjs.map +1 -0
- package/dist/chunk-C7IC36XS.cjs +13 -0
- package/dist/chunk-C7IC36XS.cjs.map +1 -0
- package/dist/chunk-D52PADVY.js +84 -0
- package/dist/chunk-D52PADVY.js.map +1 -0
- package/dist/chunk-DH6BFNVJ.cjs +272 -0
- package/dist/chunk-DH6BFNVJ.cjs.map +1 -0
- package/dist/chunk-DPCZJLB3.cjs +87 -0
- package/dist/chunk-DPCZJLB3.cjs.map +1 -0
- package/dist/chunk-EHBPIYY4.js +262 -0
- package/dist/chunk-EHBPIYY4.js.map +1 -0
- package/dist/chunk-ESMNAXUI.js +86 -0
- package/dist/chunk-ESMNAXUI.js.map +1 -0
- package/dist/chunk-ET3P6TX6.cjs +49 -0
- package/dist/chunk-ET3P6TX6.cjs.map +1 -0
- package/dist/chunk-FCXSP2YF.js +219 -0
- package/dist/chunk-FCXSP2YF.js.map +1 -0
- package/dist/chunk-IB2FSPMJ.js +66 -0
- package/dist/chunk-IB2FSPMJ.js.map +1 -0
- package/dist/chunk-IG7RSL2Y.cjs +178 -0
- package/dist/chunk-IG7RSL2Y.cjs.map +1 -0
- package/dist/chunk-IY3ALPUJ.js +2716 -0
- package/dist/chunk-IY3ALPUJ.js.map +1 -0
- package/dist/chunk-J3O2ZGG3.cjs +93 -0
- package/dist/chunk-J3O2ZGG3.cjs.map +1 -0
- package/dist/chunk-J6UXXHBE.js +37 -0
- package/dist/chunk-J6UXXHBE.js.map +1 -0
- package/dist/chunk-JLZ4LZ4Z.js +22 -0
- package/dist/chunk-JLZ4LZ4Z.js.map +1 -0
- package/dist/chunk-KIIFL4VM.js +274 -0
- package/dist/chunk-KIIFL4VM.js.map +1 -0
- package/dist/chunk-KVG3AYYR.js +99 -0
- package/dist/chunk-KVG3AYYR.js.map +1 -0
- package/dist/chunk-MBA4CLA5.js +45 -0
- package/dist/chunk-MBA4CLA5.js.map +1 -0
- package/dist/chunk-NE3QKDOB.cjs +24 -0
- package/dist/chunk-NE3QKDOB.cjs.map +1 -0
- package/dist/chunk-NVOPDXTA.cjs +95 -0
- package/dist/chunk-NVOPDXTA.cjs.map +1 -0
- package/dist/chunk-OH3QMAIB.js +11 -0
- package/dist/chunk-OH3QMAIB.js.map +1 -0
- package/dist/chunk-PHM3ZORG.cjs +110 -0
- package/dist/chunk-PHM3ZORG.cjs.map +1 -0
- package/dist/chunk-R5PXQNO3.cjs +209 -0
- package/dist/chunk-R5PXQNO3.cjs.map +1 -0
- package/dist/chunk-SLW7FRTL.cjs +285 -0
- package/dist/chunk-SLW7FRTL.cjs.map +1 -0
- package/dist/chunk-SVWRRALU.cjs +17 -0
- package/dist/chunk-SVWRRALU.cjs.map +1 -0
- package/dist/chunk-T43PQXJD.js +202 -0
- package/dist/chunk-T43PQXJD.js.map +1 -0
- package/dist/chunk-TIEAZYHF.cjs +225 -0
- package/dist/chunk-TIEAZYHF.cjs.map +1 -0
- package/dist/chunk-VBH3JLQ5.js +116 -0
- package/dist/chunk-VBH3JLQ5.js.map +1 -0
- package/dist/chunk-VF3D6KLQ.cjs +94 -0
- package/dist/chunk-VF3D6KLQ.cjs.map +1 -0
- package/dist/chunk-VTQIHMF3.js +82 -0
- package/dist/chunk-VTQIHMF3.js.map +1 -0
- package/dist/chunk-W3JN3YIW.js +15 -0
- package/dist/chunk-W3JN3YIW.js.map +1 -0
- package/dist/chunk-WANILJZQ.cjs +87 -0
- package/dist/chunk-WANILJZQ.cjs.map +1 -0
- package/dist/chunk-XC4IBCI2.js +86 -0
- package/dist/chunk-XC4IBCI2.js.map +1 -0
- package/dist/chunk-YKEWWQEJ.js +165 -0
- package/dist/chunk-YKEWWQEJ.js.map +1 -0
- package/dist/chunk-YQL7NISX.cjs +515 -0
- package/dist/chunk-YQL7NISX.cjs.map +1 -0
- package/dist/chunk-ZB6SVBK4.js +89 -0
- package/dist/chunk-ZB6SVBK4.js.map +1 -0
- package/dist/combo/react.cjs +235 -0
- package/dist/combo/react.cjs.map +1 -0
- package/dist/combo/react.d.cts +148 -0
- package/dist/combo/react.d.ts +148 -0
- package/dist/combo/react.js +230 -0
- package/dist/combo/react.js.map +1 -0
- package/dist/combo.cjs +262 -0
- package/dist/combo.cjs.map +1 -0
- package/dist/combo.d.cts +139 -0
- package/dist/combo.d.ts +139 -0
- package/dist/combo.js +249 -0
- package/dist/combo.js.map +1 -0
- package/dist/config-CHjz7ZjZ.d.cts +57 -0
- package/dist/config-COjhIZTh.d.ts +57 -0
- package/dist/doctor.cjs +354 -0
- package/dist/doctor.cjs.map +1 -0
- package/dist/doctor.d.cts +177 -0
- package/dist/doctor.d.ts +177 -0
- package/dist/doctor.js +345 -0
- package/dist/doctor.js.map +1 -0
- package/dist/erc7677-DOW58QBE.d.cts +111 -0
- package/dist/erc7677-DOW58QBE.d.ts +111 -0
- package/dist/errors-CgX1vNj7.d.cts +100 -0
- package/dist/errors-CgX1vNj7.d.ts +100 -0
- package/dist/index.cjs +802 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2398 -0
- package/dist/index.d.ts +2398 -0
- package/dist/index.js +559 -0
- package/dist/index.js.map +1 -0
- package/dist/paymaster/server.cjs +38 -0
- package/dist/paymaster/server.cjs.map +1 -0
- package/dist/paymaster/server.d.cts +57 -0
- package/dist/paymaster/server.d.ts +57 -0
- package/dist/paymaster/server.js +36 -0
- package/dist/paymaster/server.js.map +1 -0
- package/dist/paymaster.cjs +356 -0
- package/dist/paymaster.cjs.map +1 -0
- package/dist/paymaster.d.cts +1851 -0
- package/dist/paymaster.d.ts +1851 -0
- package/dist/paymaster.js +289 -0
- package/dist/paymaster.js.map +1 -0
- package/dist/privy/react.cjs +48 -0
- package/dist/privy/react.cjs.map +1 -0
- package/dist/privy/react.d.cts +194 -0
- package/dist/privy/react.d.ts +194 -0
- package/dist/privy/react.js +7 -0
- package/dist/privy/react.js.map +1 -0
- package/dist/privy/server.cjs +43 -0
- package/dist/privy/server.cjs.map +1 -0
- package/dist/privy/server.d.cts +192 -0
- package/dist/privy/server.d.ts +192 -0
- package/dist/privy/server.js +6 -0
- package/dist/privy/server.js.map +1 -0
- package/dist/privy/wagmi.d.ts +90 -0
- package/dist/privy/wagmi.js +55 -0
- package/dist/privy/wagmi.js.map +1 -0
- package/dist/privy.cjs +34 -0
- package/dist/privy.cjs.map +1 -0
- package/dist/privy.d.cts +4 -0
- package/dist/privy.d.ts +4 -0
- package/dist/privy.js +5 -0
- package/dist/privy.js.map +1 -0
- package/dist/react.cjs +72 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +66 -0
- package/dist/react.d.ts +66 -0
- package/dist/react.js +68 -0
- package/dist/react.js.map +1 -0
- package/dist/requirements-C-QiJkL9.d.cts +134 -0
- package/dist/requirements-C-QiJkL9.d.ts +134 -0
- package/dist/scope-DBRkN7bR.d.cts +94 -0
- package/dist/scope-DBRkN7bR.d.ts +94 -0
- package/dist/server.cjs +59 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +208 -0
- package/dist/server.d.ts +208 -0
- package/dist/server.js +8 -0
- package/dist/server.js.map +1 -0
- package/dist/session/kernel.cjs +82 -0
- package/dist/session/kernel.cjs.map +1 -0
- package/dist/session/kernel.d.cts +131 -0
- package/dist/session/kernel.d.ts +131 -0
- package/dist/session/kernel.js +13 -0
- package/dist/session/kernel.js.map +1 -0
- package/dist/session/react.cjs +37 -0
- package/dist/session/react.cjs.map +1 -0
- package/dist/session/react.d.cts +119 -0
- package/dist/session/react.d.ts +119 -0
- package/dist/session/react.js +8 -0
- package/dist/session/react.js.map +1 -0
- package/dist/session/server.cjs +267 -0
- package/dist/session/server.cjs.map +1 -0
- package/dist/session/server.d.cts +151 -0
- package/dist/session/server.d.ts +151 -0
- package/dist/session/server.js +252 -0
- package/dist/session/server.js.map +1 -0
- package/dist/session.cjs +74 -0
- package/dist/session.cjs.map +1 -0
- package/dist/session.d.cts +3 -0
- package/dist/session.d.ts +3 -0
- package/dist/session.js +5 -0
- package/dist/session.js.map +1 -0
- package/dist/status-CmOsyPmO.d.cts +295 -0
- package/dist/status-DwkkOrGQ.d.ts +295 -0
- package/dist/store-CjmLgp9g.d.cts +64 -0
- package/dist/store-CjmLgp9g.d.ts +64 -0
- package/dist/types-BEEM7WdG.d.cts +25 -0
- package/dist/types-BEEM7WdG.d.ts +25 -0
- package/dist/types-BilBTDqK.d.cts +27 -0
- package/dist/types-BilBTDqK.d.ts +27 -0
- package/package.json +209 -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 };
|
package/dist/server.cjs
ADDED
|
@@ -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"]}
|