i2pseeds 0.1.1 → 2026.3.2

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 CHANGED
@@ -1,21 +1,128 @@
1
- # su3
1
+ # i2pseeds
2
2
 
3
- i2pseeds
3
+ [![npm version](https://img.shields.io/npm/v/i2pseeds)](https://www.npmjs.com/package/i2pseeds)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
4
5
 
5
- ## Usage
6
+ A TypeScript library and CLI for I2P network reseeding. Parse and verify [SU3](https://geti2p.net/spec/updates#su3-file-specification) files, extract router info into a netDb directory, and download fresh seeds from reseed servers — all with cryptographic signature verification.
7
+
8
+ ## Features
9
+
10
+ - **SU3 parsing** — read headers, signer IDs, content types, and version info
11
+ - **Signature verification** — verify RSA / ECDSA / DSA signatures against bundled X.509 certificates
12
+ - **NetDb extraction** — unpack `routerInfo-*.dat` entries into the standard `netdb/r*/` directory layout
13
+ - **Live reseeding** — download `.su3` files from community reseed servers with configurable timeouts
14
+ - **Bundled seeds & certs** — ships with pre-fetched seeds and all current reseed server certificates
15
+ - **CLI + API** — use from the command line or import into your own TypeScript / JavaScript project
16
+
17
+ ## Installation
6
18
 
7
19
  ```bash
8
- bunx su3 netdb
20
+ # npm
21
+ npm install i2pseeds
22
+
23
+ # bun
24
+ bun add i2pseeds
25
+ ```
26
+
27
+ ## CLI Usage
28
+
29
+ The CLI exposes a single `netdb` command that extracts router info into a `./netdb` directory.
30
+
31
+ ```bash
32
+ # Extract from bundled seeds (no network access needed)
33
+ npx i2pseeds netdb
34
+
35
+ # Download fresh seeds from reseed servers first, then extract
36
+ npx i2pseeds netdb --refresh
37
+ ```
38
+
39
+ ## Programmatic API
40
+
41
+ ```ts
42
+ import {
43
+ parseSu3Header,
44
+ verifySu3Signature,
45
+ extractZipFromSu3,
46
+ extractNetDb,
47
+ refreshSeeds,
48
+ } from "i2pseeds";
49
+ ```
50
+
51
+ ### `parseSu3Header(buf: Buffer): Su3Header | null`
52
+
53
+ Parse the SU3 header from a raw buffer. Returns `null` if the buffer does not start with the `I2Psu3` magic bytes.
54
+
55
+ ```ts
56
+ const header = parseSu3Header(raw);
57
+ console.log(header?.signerId); // "sahil@mail.i2p"
58
+ console.log(header?.sigType); // 6 (RSA-SHA512-4096)
59
+ ```
60
+
61
+ ### `verifySu3Signature(su3Buffer: Buffer, certPem: string): boolean`
62
+
63
+ Verify the cryptographic signature of an SU3 file against a PEM-encoded certificate.
64
+
65
+ ```ts
66
+ import fs from "node:fs/promises";
67
+
68
+ const cert = await fs.readFile("cert.crt", "utf8");
69
+ const valid = verifySu3Signature(su3Buffer, cert);
9
70
  ```
10
71
 
11
- ## Usage
72
+ ### `extractZipFromSu3(su3Buffer: Buffer): Buffer | null`
12
73
 
13
- ```typescript
14
- import { greet } from 'su3';
74
+ Strip the SU3 header and return the raw ZIP payload. Returns `null` if no ZIP magic is found.
15
75
 
16
- console.log(greet('World')); // Hello, World!
76
+ ### `extractNetDb(seedsDir, targetDir, crtDir?, servers?): Promise<ExtractResult>`
77
+
78
+ Extract all `routerInfo-*.dat` entries from every `.su3` file in `seedsDir` into `targetDir`. When `crtDir` and `servers` are provided, each file is verified against the mapped certificate.
79
+
80
+ ```ts
81
+ const result = await extractNetDb("./seeds", "./netdb", "./certs", servers);
82
+ console.log(`Extracted ${result.count} router entries`);
83
+ ```
84
+
85
+ ### `refreshSeeds(servers, outputDir, timeoutMs?): Promise<string[]>`
86
+
87
+ Download fresh `.su3` files from the given reseed servers. Returns a list of saved file paths.
88
+
89
+ ```ts
90
+ const saved = await refreshSeeds(servers, "./seeds", 15000);
91
+ ```
92
+
93
+ ## Reseed Servers
94
+
95
+ The package includes a [`reseed.json`](src/reseed.json) file mapping reseed server URLs to their certificate files. The bundled list currently covers 12 community reseed servers.
96
+
97
+ ## CDN
98
+
99
+ The bundled reseed data and certificates can also be downloaded directly from jsDelivr:
100
+
101
+ ```
102
+ https://cdn.jsdelivr.net/npm/i2pseeds@latest/dist/data/
17
103
  ```
18
104
 
105
+ ## Development
106
+
107
+ ```bash
108
+ # Install dependencies
109
+ bun install
110
+
111
+ # Build
112
+ bun run build
113
+
114
+ # Run tests
115
+ bun test
116
+
117
+ # Lint
118
+ bun run lint
119
+
120
+ # Type-check
121
+ bun run type-check
122
+ ```
123
+
124
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for the full development workflow.
125
+
19
126
  ## License
20
127
 
21
- MIT
128
+ [MIT](LICENSE) © labofsahil
package/package.json CHANGED
@@ -1,7 +1,21 @@
1
1
  {
2
2
  "name": "i2pseeds",
3
- "version": "0.1.1",
4
- "description": "i2pseeds",
3
+ "version": "2026.03.02",
4
+ "description": "TypeScript library and CLI for I2P network reseeding — parse SU3 files, verify signatures, and extract router info into netDb",
5
+ "author": "labofsahil",
6
+ "keywords": [
7
+ "i2p",
8
+ "su3",
9
+ "reseed",
10
+ "netdb",
11
+ "router-info",
12
+ "privacy",
13
+ "anonymity",
14
+ "cryptography",
15
+ "signature-verification",
16
+ "i2p-network",
17
+ "dark-net"
18
+ ],
5
19
  "homepage": "https://github.com/labofsahil/su3#readme",
6
20
  "bugs": {
7
21
  "url": "https://github.com/labofsahil/su3/issues"