solana-messenger-sdk 1.5.2 → 1.5.3
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 +27 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -62,6 +62,33 @@ const messenger = new SolanaMessenger({
|
|
|
62
62
|
await messenger.init(); // no filesystem access needed
|
|
63
63
|
```
|
|
64
64
|
|
|
65
|
+
## Architecture: Keys & Roles
|
|
66
|
+
|
|
67
|
+
Every user has **two separate keypairs**:
|
|
68
|
+
|
|
69
|
+
| Key | Purpose | Who holds it |
|
|
70
|
+
|-----|---------|-------------|
|
|
71
|
+
| **Wallet key (A)** | Signs transactions | User, or custodial service (Privy, Turnkey) |
|
|
72
|
+
| **Encryption key (B)** | Encrypts/decrypts messages | User's device only — never shared |
|
|
73
|
+
|
|
74
|
+
`init()` generates key B, stores it locally (or accepts it via `encryptionKeypair` config), and registers the public part on-chain. Messages are encrypted with B — custodial services that hold A **cannot** read messages.
|
|
75
|
+
|
|
76
|
+
### Who needs what
|
|
77
|
+
|
|
78
|
+
| Role | Wallet key (A) | Encryption key (B) | Calls `init()`? |
|
|
79
|
+
|------|:-:|:-:|:-:|
|
|
80
|
+
| **End user** | ✅ | ✅ | Yes |
|
|
81
|
+
| **Relayer / backend** | ❌ | ❌ | **No** |
|
|
82
|
+
|
|
83
|
+
A **relayer** only forwards pre-signed transactions to the RPC — it doesn't instantiate `SolanaMessenger` or call `init()`. It just needs a Solana RPC connection:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
// Relayer — no SDK needed, just forward signed tx bytes
|
|
87
|
+
import { Connection } from "@solana/web3.js";
|
|
88
|
+
const conn = new Connection(rpcUrl);
|
|
89
|
+
const sig = await conn.sendRawTransaction(signedTxBytes);
|
|
90
|
+
```
|
|
91
|
+
|
|
65
92
|
## API
|
|
66
93
|
|
|
67
94
|
### Direct Messages
|