@suman-jangili/privacy-first-server 0.1.6 → 0.1.7

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.
Files changed (2) hide show
  1. package/README.md +78 -54
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,17 +1,13 @@
1
1
 
2
- ---
3
-
4
- ## 📄 `privacy‑first‑server` – README.md
5
-
6
- ```markdown
7
- # @suman-jangili/privacy‑first‑server
2
+ 📄 `privacy‑first‑server`
8
3
 
4
+ ## @suman-jangili/privacy‑first‑server
9
5
  A minimal **privacy‑first** backend built with **Express**, **TypeScript**, and **libsodium‑wrappers**.
10
6
  It provides a tiny API for generating key pairs, encrypting, and decrypting data—perfect for pairing with the companion client package (`@suman-jangili/privacy‑first‑client`).
11
7
 
12
8
  ---
13
9
 
14
- ## Table of Contents
10
+ ### Table of Contents
15
11
 
16
12
  - [Installation](#installation)
17
13
  - [Running Locally](#running-locally)
@@ -24,72 +20,100 @@ It provides a tiny API for generating key pairs, encrypting, and decrypting data
24
20
 
25
21
  ---
26
22
 
27
- ## Installation
28
-
23
+ ### Installation
24
+ From npm:
29
25
  ```bash
30
- # From npm
31
26
  npm install @suman-jangili/privacy-first-server
32
-
33
- # Or add it as a dependency in your own project
27
+ ```
28
+ **Or** add it as a dependency in your own project
29
+ ```bash
34
30
  npm i @suman-jangili/privacy-first-server
35
-
31
+ ```
36
32
  To develop the server yourself, clone the repo and install dev dependencies:
33
+ ```bash
37
34
  git clone https://github.com/sumanjangili/privacy-first.git
38
35
  cd privacy-first/server
39
36
  npm ci # installs exact versions from lockfile
37
+ ```
40
38
 
41
- Running Locally
42
- # Build the TypeScript sources
43
- npm run build
44
-
45
- # Start the server (defaults to PORT 3000)
46
- npm start
47
-
48
- The server will listen on http://localhost:3000. You can also use the development script for hot‑reloading:
49
- npm run dev
50
-
39
+ ---
51
40
 
52
- API Endpoints
53
- Method Path Description
54
- GET /health Simple health check ({ ok: true }).
55
- POST /keypair Returns a freshly generated NaCl key pair (publicKey, secretKey).
56
- POST /encrypt Body: { publicKey, secretKey?, message } → Returns { ciphertext, nonce }.
57
- POST /decrypt Body: { publicKey, secretKey, ciphertext, nonce } → Returns { message }.
58
- All payloads and responses are JSON‑encoded. Errors are returned with a 400 status and an error field describing the problem.
59
- Scripts Overview
60
- Script Description
61
- dev Runs ts-node-dev for live reload while developing.
62
- build Compiles TypeScript to dist/ (tsc).
63
- start Executes the compiled server (node dist/index.js).
64
- gen:keypair Utility script to generate a key pair from the CLI (npm run gen:keypair).
41
+ ### Running Locally
42
+ 1. Build the TypeScript sources
43
+ ```bash
44
+ npm run build
45
+ ```
46
+ 2. Start the server (defaults to PORT 3000)
47
+ ```bash
48
+ npm start
49
+ ```
50
+ 3. The server will listen on http://localhost:3000. You can also use the development script for hot‑reloading:
51
+ ```bash
52
+ npm run dev
53
+ ```
54
+ ---
65
55
 
66
- Building & Publishing
67
- When you’re ready to publish a new version to npm:
56
+ #### API Endpoints
57
+ *Method Path Description*
58
+ - **GET /health** Simple health check ({ ok: true }).
59
+ - **POST /keypair** Returns a freshly generated NaCl key pair (publicKey, secretKey).
60
+ - **POST /encrypt** Body: { publicKey, secretKey?, message } → Returns { ciphertext, nonce }.
61
+ - **POST /decrypt** Body: { publicKey, secretKey, ciphertext, nonce } → Returns { message }.
62
+ - All payloads and responses are JSON‑encoded. Errors are returned with a 400 status and an error field describing the problem.
68
63
 
69
- # Bump the version (patch, minor, or major)
70
- npm version patch # → e.g., 0.1.6 → 0.1.7
64
+ ---
71
65
 
72
- # Compile the code
73
- npm run build
66
+ #### Scripts Overview
67
+ - **dev** Runs ts-node-dev for live reload while developing.
68
+ - **build** Compiles TypeScript to dist/ (tsc).
69
+ - **start** Executes the compiled server (node dist/index.js).
70
+ - **gen:keypair** Utility script to generate a key pair from the CLI:
71
+ ```bash
72
+ npm run gen:keypair
73
+ ```
74
74
 
75
- # Publish (public)
76
- npm publish --access public
75
+ ---
77
76
 
77
+ ### Building & Publishing
78
+ When you’re ready to publish a new version to npm:
79
+ 1. Bump the version (patch, minor, or major)
80
+ ```bash
81
+ npm version patch # → e.g., 0.1.6 → 0.1.7
82
+ ```
83
+ 2. Compile the code
84
+ ```bash
85
+ npm run build
86
+ ```
87
+ 3. Publish (public)
88
+ ```bash
89
+ npm publish --access public
90
+ ```
78
91
  The package ships type declarations (*.d.ts) automatically, so consumers get full TypeScript support.
79
92
 
80
- Contributing
93
+ ---
94
+
95
+ ### Contributing
81
96
  We love contributions! Follow these steps:
82
- Fork the repository.
83
- Create a feature branch (git checkout -b feat/awesome-feature).
84
- Implement your change and run the test suite (npm test if you add tests) and lint (npm run lint).
85
- Ensure TypeScript compiles (npm run typecheck).
86
- Open a Pull Request against main.
97
+ 1. Fork the repository.
98
+ 2. Create a feature branch
99
+ ```bash
100
+ git checkout -b feat/awesome-feature
101
+ ```
102
+ 3. Implement your change and run the test suite and lint to ensure TypeScript compiles:
103
+ ```bash
104
+ npm test && npm run lint && npm run typecheck
105
+ ```
106
+ 4. Open a Pull Request against main.
87
107
  Please keep the API surface stable and add documentation for any new endpoints.
88
108
 
89
- License
109
+ ---
110
+
111
+ ### License
90
112
  MIT © Suman Jangili. See the LICENSE file for full terms.
91
113
 
92
- Related Projects
93
- Client: https://www.npmjs.com/package/@suman-jangili/privacy-first-client – the React front‑end that talks to this API.
94
- Full Demo Repo: https://github.com/sumanjangili/privacy-first
114
+ ---
115
+
116
+ #### Related Projects
117
+ - [Client](https://www.npmjs.com/package/@suman-jangili/privacy-first-client) – the React front‑end that talks to this API.
118
+ - [See Full Demo Repo](https://github.com/sumanjangili/privacy-first)
95
119
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suman-jangili/privacy-first-server",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "__comment": "Server side of the privacy‑first demo – tiny Express API",
5
5
  "scripts": {
6
6
  "dev": "ts-node-dev --respawn --transpile-only src/index.ts",