@zeph-to/hook-sdk 1.5.2 → 1.6.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 +3 -1
- package/dist/crypto.d.ts.map +1 -1
- package/dist/crypto.js +19 -9
- 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
|
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;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,CAsE5E,CAAC;AAqCF,eAAO,MAAM,UAAU,QAAO,aAAa,GAAG,IAAqB,CAAC;AACpE,eAAO,MAAM,YAAY,QAAO,MAAM,GAAG,IAA+B,CAAC;AAEzE;;;GAGG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,EACtD,uBAAuB,MAAM,KAC5B,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,IAAI,CAAC;CACnB,CAeA,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,OAAO;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,KACrD,OAAO,CAAC;IACT,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,IAAI,CAAC;CACnB,CAaA,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,uBAAuB,GAClC,SAAS,MAAM,EACf,uBAAuB,MAAM,KAC5B,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CASlE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,SAAS,MAAM,KACd,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,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;
|