gupt-sdk 0.2.0 → 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.
- package/README.md +31 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,6 +49,37 @@ await ctx.replyFile("./report.pdf", {
|
|
|
49
49
|
});
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
+
## Encrypted ntfy.sh-style notifications
|
|
53
|
+
|
|
54
|
+
A bot can initiate a message using only the recipient's GUPT public key; `reply()` and `replyFile()`
|
|
55
|
+
do not require a preceding inbound message. This makes `gupt-sdk` useful as an end-to-end encrypted,
|
|
56
|
+
self-hosted alternative to ntfy.sh for monitoring jobs, backups, CI, and server alerts.
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
import { GuptBot } from "gupt-sdk";
|
|
60
|
+
|
|
61
|
+
const bot = new GuptBot({
|
|
62
|
+
secretHex: process.env.GUPT_BOT_KEY,
|
|
63
|
+
relays: ["wss://relay-a.example", "wss://relay-b.example"],
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
await bot.start();
|
|
67
|
+
|
|
68
|
+
await bot.reply(process.env.GUPT_USER_PUBKEY, "Backup completed successfully");
|
|
69
|
+
await bot.replyFile(process.env.GUPT_USER_PUBKEY, "./backup-report.txt", {
|
|
70
|
+
mime: "text/plain",
|
|
71
|
+
});
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Unlike a public notification topic, the recipient public key identifies who can decrypt the
|
|
75
|
+
notification. Events remain encrypted on relays and carry GUPT's standard 100-day expiration.
|
|
76
|
+
|
|
77
|
+
Public keys do not contain relay addresses. For reliable delivery, configure at least one relay
|
|
78
|
+
that the recipient also uses, or have the recipient message the bot first so it can learn their
|
|
79
|
+
signed relay hint. Learned hints are currently memory-only and are rediscovered after a bot
|
|
80
|
+
restart. GUPT retrieves stored notifications when it reconnects, but this is not an operating-system
|
|
81
|
+
push wake-up mechanism while the app is fully closed.
|
|
82
|
+
|
|
52
83
|
Inbound messages teach the bot both the ingress relay and the sender relay hint carried in the
|
|
53
84
|
signed `p` tag. Learned hints are bounded and obvious local/private addresses are rejected. Replies
|
|
54
85
|
try the ingress relay first, then the peer's learned relays and the configured bootstrap relays.
|
package/package.json
CHANGED