stellar-shade 0.0.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 +69 -0
- package/dist/index.cjs +838 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +159 -0
- package/dist/index.d.ts +159 -0
- package/dist/index.js +817 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# stellar-shade
|
|
2
|
+
|
|
3
|
+
**Privacy-preserving stealth payments on Stellar** — a high-level client SDK built on
|
|
4
|
+
DKSAP (Dual-Key Stealth Address Protocol) over ed25519.
|
|
5
|
+
|
|
6
|
+
`stellar-shade` lets a sender pay a recipient's published *meta-address* while the
|
|
7
|
+
on-chain destination looks unlinkable to outside observers. It bundles the underlying
|
|
8
|
+
stealth-address cryptography, so you only need to install one package.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install stellar-shade
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quick start
|
|
17
|
+
|
|
18
|
+
```ts
|
|
19
|
+
import { StealthClient } from 'stellar-shade';
|
|
20
|
+
|
|
21
|
+
const client = new StealthClient({
|
|
22
|
+
network: 'testnet',
|
|
23
|
+
contractId: 'CAZRCYBRYP3FEWJX4D5NO6FK4THZ5O5OQGEJ4RBOPQ4IS5IRBUGHBA26',
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// Generate stealth keys (no network needed)
|
|
27
|
+
const bobKeys = StealthClient.keygen();
|
|
28
|
+
// bobKeys.metaAddress → "st:stellar:..." (share this publicly)
|
|
29
|
+
|
|
30
|
+
// Alice sends 100 XLM to Bob's stealth meta-address
|
|
31
|
+
const receipt = await client.send(bobKeys.metaAddress, 100, aliceSecret);
|
|
32
|
+
// receipt.stealthAddress, receipt.txHash
|
|
33
|
+
|
|
34
|
+
// Bob scans for received payments
|
|
35
|
+
const payments = await client.scan(bobKeys);
|
|
36
|
+
// [{ stealthAddress, amount: 100, token: "C..." }]
|
|
37
|
+
|
|
38
|
+
// Bob withdraws to his real address
|
|
39
|
+
const result = await client.withdraw(payments[0].stealthAddress, bobPublicKey, {
|
|
40
|
+
keys: bobKeys,
|
|
41
|
+
feePayer: feePayerSecret,
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Deployed testnet contract
|
|
46
|
+
|
|
47
|
+
A registry contract is already live on the Stellar **testnet**, so you can try the SDK
|
|
48
|
+
without deploying anything:
|
|
49
|
+
|
|
50
|
+
| | |
|
|
51
|
+
|---|---|
|
|
52
|
+
| **Contract ID** | `CAZRCYBRYP3FEWJX4D5NO6FK4THZ5O5OQGEJ4RBOPQ4IS5IRBUGHBA26` |
|
|
53
|
+
| **Network** | Testnet (`Test SDF Network ; September 2015`) |
|
|
54
|
+
| **Explorer** | https://stellar.expert/explorer/testnet/contract/CAZRCYBRYP3FEWJX4D5NO6FK4THZ5O5OQGEJ4RBOPQ4IS5IRBUGHBA26 |
|
|
55
|
+
|
|
56
|
+
## API
|
|
57
|
+
|
|
58
|
+
- `StealthClient.keygen()` — generate a stealth key pair + shareable meta-address.
|
|
59
|
+
- `new StealthClient({ network, contractId })` — create a client (`network`: `testnet` | `local`).
|
|
60
|
+
- `client.send(metaAddress, amount, sourceSecret)` — pay a meta-address.
|
|
61
|
+
- `client.scan(keys)` — find payments received to your stealth addresses.
|
|
62
|
+
- `client.balance(stealthAddress)` — check a stealth account balance.
|
|
63
|
+
- `client.withdraw(stealthAddress, destination, opts)` — move funds out.
|
|
64
|
+
|
|
65
|
+
TypeScript type definitions are included.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|