@zeph-to/hook-sdk 1.5.2 → 1.7.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/README.md +7 -1
- package/dist/cli.js +5 -1
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +19 -9
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ zeph notify --title "Hello" --json
|
|
|
54
54
|
| `notify` | Send a push notification |
|
|
55
55
|
| `list` | List recent push notifications |
|
|
56
56
|
| `dismiss <id>` | Dismiss a push (or `--all`) |
|
|
57
|
-
| `test` |
|
|
57
|
+
| `test` | Verify connection and API key |
|
|
58
58
|
|
|
59
59
|
### Notify Options
|
|
60
60
|
|
|
@@ -85,6 +85,8 @@ zeph notify --title "Hello" --json
|
|
|
85
85
|
|
|
86
86
|
### Mute
|
|
87
87
|
|
|
88
|
+
Mute is project-scoped (uses project directory hash). Created by Claude Code `/zeph-mute` command.
|
|
89
|
+
|
|
88
90
|
Notifications are silently skipped when a mute file exists for the current project:
|
|
89
91
|
|
|
90
92
|
```bash
|
|
@@ -186,6 +188,10 @@ try {
|
|
|
186
188
|
| Copilot CLI | Session end hook |
|
|
187
189
|
| Cline | Rules file |
|
|
188
190
|
|
|
191
|
+
## E2E Encryption
|
|
192
|
+
|
|
193
|
+
Notifications are encrypted end-to-end by default (AES-256-GCM + ECDH P-256). Keys are synced with the server automatically. When encryption is disabled in the Zeph app, the CLI sends plaintext. No configuration needed.
|
|
194
|
+
|
|
189
195
|
## Requirements
|
|
190
196
|
|
|
191
197
|
- Node.js >= 18 (uses native `fetch`)
|
package/dist/cli.js
CHANGED
|
@@ -62,6 +62,7 @@ Notify options:
|
|
|
62
62
|
--type <type> Push type (note|link|file|hook) [default: hook]
|
|
63
63
|
--priority <p> Priority (low|normal|high|urgent) [default: normal]
|
|
64
64
|
--device <id> Target device ID
|
|
65
|
+
--session <id> AI session ID (or set ZEPH_SESSION_ID env)
|
|
65
66
|
|
|
66
67
|
List options:
|
|
67
68
|
--limit <n> Number of pushes (1-20, default 5)
|
|
@@ -83,7 +84,8 @@ Global options:
|
|
|
83
84
|
|
|
84
85
|
Environment:
|
|
85
86
|
ZEPH_API_KEY API key (fallback when --key not provided)
|
|
86
|
-
ZEPH_BASE_URL API base URL (fallback when --base-url not provided)
|
|
87
|
+
ZEPH_BASE_URL API base URL (fallback when --base-url not provided)
|
|
88
|
+
ZEPH_SESSION_ID AI session ID (fallback when --session not provided)`);
|
|
87
89
|
};
|
|
88
90
|
const printError = (message, isJson) => {
|
|
89
91
|
if (isJson) {
|
|
@@ -119,6 +121,7 @@ const handleNotify = async (args) => {
|
|
|
119
121
|
if (!hook)
|
|
120
122
|
return 3;
|
|
121
123
|
try {
|
|
124
|
+
const sessionId = args.session || (0, config_js_1.resolvedEnv)('ZEPH_SESSION_ID') || undefined;
|
|
122
125
|
const result = await hook.notify({
|
|
123
126
|
title: args.title,
|
|
124
127
|
body: args.body,
|
|
@@ -126,6 +129,7 @@ const handleNotify = async (args) => {
|
|
|
126
129
|
type: args.type || 'hook',
|
|
127
130
|
priority: args.priority || undefined,
|
|
128
131
|
targetDeviceId: args.device,
|
|
132
|
+
sessionId,
|
|
129
133
|
});
|
|
130
134
|
if (isJson) {
|
|
131
135
|
printJson({ pushId: result.pushId, status: 'ok' });
|
package/dist/crypto.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0JH;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA0JH;;;;;GAKG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M,CAAA;CAAE,CAQlE,CAAC"}
|
package/dist/crypto.js
CHANGED
|
@@ -112,16 +112,23 @@ const initCrypto = (apiKey, baseUrl) => {
|
|
|
112
112
|
const stored = loadStoredKeys();
|
|
113
113
|
// Try server sync if API key available
|
|
114
114
|
if (apiKey) {
|
|
115
|
-
const
|
|
116
|
-
|
|
115
|
+
const serverResult = await fetchServerKeys(apiKey, baseUrl);
|
|
116
|
+
// Server says encryption disabled — skip crypto init
|
|
117
|
+
if (serverResult && !serverResult.encryptionEnabled) {
|
|
118
|
+
cachedKeyPair = null;
|
|
119
|
+
cachedExportedPublicKey = null;
|
|
120
|
+
cachedOwnPublicKey = null;
|
|
121
|
+
return '';
|
|
122
|
+
}
|
|
123
|
+
if (serverResult?.keys) {
|
|
117
124
|
// Server has keys — adopt them (server is source of truth)
|
|
118
|
-
if (!stored || stored.publicKey !==
|
|
119
|
-
storeKeys(
|
|
125
|
+
if (!stored || stored.publicKey !== serverResult.keys.publicKey) {
|
|
126
|
+
storeKeys(serverResult.keys);
|
|
120
127
|
}
|
|
121
|
-
cachedKeyPair = await importKeyPair(
|
|
122
|
-
cachedExportedPublicKey =
|
|
128
|
+
cachedKeyPair = await importKeyPair(serverResult.keys);
|
|
129
|
+
cachedExportedPublicKey = serverResult.keys.publicKey;
|
|
123
130
|
cachedOwnPublicKey = cachedKeyPair.publicKey;
|
|
124
|
-
return
|
|
131
|
+
return serverResult.keys.publicKey;
|
|
125
132
|
}
|
|
126
133
|
// Server has no keys
|
|
127
134
|
if (stored) {
|
|
@@ -163,7 +170,6 @@ const initCrypto = (apiKey, baseUrl) => {
|
|
|
163
170
|
return initPromise;
|
|
164
171
|
};
|
|
165
172
|
exports.initCrypto = initCrypto;
|
|
166
|
-
// ─── Server key sync helpers ───
|
|
167
173
|
const fetchServerKeys = async (apiKey, baseUrl) => {
|
|
168
174
|
try {
|
|
169
175
|
const url = `${(baseUrl ?? 'https://api.zeph.to/v1').replace(/\/$/, '')}/users/me/keys`;
|
|
@@ -172,7 +178,11 @@ const fetchServerKeys = async (apiKey, baseUrl) => {
|
|
|
172
178
|
return null;
|
|
173
179
|
const json = await res.json();
|
|
174
180
|
const keys = json.data?.encryptionKeys;
|
|
175
|
-
|
|
181
|
+
const encryptionEnabled = json.data?.encryptionEnabled ?? (keys ? true : false);
|
|
182
|
+
return {
|
|
183
|
+
keys: keys?.publicKey && keys?.privateKey ? keys : null,
|
|
184
|
+
encryptionEnabled,
|
|
185
|
+
};
|
|
176
186
|
}
|
|
177
187
|
catch {
|
|
178
188
|
return null;
|
package/dist/types.d.ts
CHANGED
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IACzC,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;IAChD,cAAc,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd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