@suman-jangili/privacy-first-server 0.1.5 → 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 +119 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,119 @@
1
+
2
+ 📄 `privacy‑first‑server`
3
+
4
+ ## @suman-jangili/privacy‑first‑server
5
+ A minimal **privacy‑first** backend built with **Express**, **TypeScript**, and **libsodium‑wrappers**.
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`).
7
+
8
+ ---
9
+
10
+ ### Table of Contents
11
+
12
+ - [Installation](#installation)
13
+ - [Running Locally](#running-locally)
14
+ - [API Endpoints](#api-endpoints)
15
+ - [Scripts Overview](#scripts-overview)
16
+ - [Building & Publishing](#building--publishing)
17
+ - [Contributing](#contributing)
18
+ - [License](#license)
19
+ - [Related Projects](#related-projects)
20
+
21
+ ---
22
+
23
+ ### Installation
24
+ From npm:
25
+ ```bash
26
+ npm install @suman-jangili/privacy-first-server
27
+ ```
28
+ **Or** add it as a dependency in your own project
29
+ ```bash
30
+ npm i @suman-jangili/privacy-first-server
31
+ ```
32
+ To develop the server yourself, clone the repo and install dev dependencies:
33
+ ```bash
34
+ git clone https://github.com/sumanjangili/privacy-first.git
35
+ cd privacy-first/server
36
+ npm ci # installs exact versions from lockfile
37
+ ```
38
+
39
+ ---
40
+
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
+ ---
55
+
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.
63
+
64
+ ---
65
+
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
+
75
+ ---
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
+ ```
91
+ The package ships type declarations (*.d.ts) automatically, so consumers get full TypeScript support.
92
+
93
+ ---
94
+
95
+ ### Contributing
96
+ We love contributions! Follow these steps:
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.
107
+ Please keep the API surface stable and add documentation for any new endpoints.
108
+
109
+ ---
110
+
111
+ ### License
112
+ MIT © Suman Jangili. See the LICENSE file for full terms.
113
+
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)
119
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@suman-jangili/privacy-first-server",
3
- "version": "0.1.5",
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",
@@ -43,6 +43,6 @@
43
43
  "homepage": "https://github.com/sumanjangili/privacy-first",
44
44
  "files": [
45
45
  "dist",
46
- "README"
46
+ "README.md"
47
47
  ]
48
48
  }