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

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 +95 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,95 @@
1
+
2
+ ---
3
+
4
+ ## 📄 `privacy‑first‑server` – README.md
5
+
6
+ ```markdown
7
+ # @suman-jangili/privacy‑first‑server
8
+
9
+ A minimal **privacy‑first** backend built with **Express**, **TypeScript**, and **libsodium‑wrappers**.
10
+ 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
+
12
+ ---
13
+
14
+ ## Table of Contents
15
+
16
+ - [Installation](#installation)
17
+ - [Running Locally](#running-locally)
18
+ - [API Endpoints](#api-endpoints)
19
+ - [Scripts Overview](#scripts-overview)
20
+ - [Building & Publishing](#building--publishing)
21
+ - [Contributing](#contributing)
22
+ - [License](#license)
23
+ - [Related Projects](#related-projects)
24
+
25
+ ---
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ # From npm
31
+ npm install @suman-jangili/privacy-first-server
32
+
33
+ # Or add it as a dependency in your own project
34
+ npm i @suman-jangili/privacy-first-server
35
+
36
+ To develop the server yourself, clone the repo and install dev dependencies:
37
+ git clone https://github.com/sumanjangili/privacy-first.git
38
+ cd privacy-first/server
39
+ npm ci # installs exact versions from lockfile
40
+
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
+
51
+
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).
65
+
66
+ Building & Publishing
67
+ When you’re ready to publish a new version to npm:
68
+
69
+ # Bump the version (patch, minor, or major)
70
+ npm version patch # → e.g., 0.1.6 → 0.1.7
71
+
72
+ # Compile the code
73
+ npm run build
74
+
75
+ # Publish (public)
76
+ npm publish --access public
77
+
78
+ The package ships type declarations (*.d.ts) automatically, so consumers get full TypeScript support.
79
+
80
+ Contributing
81
+ 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.
87
+ Please keep the API surface stable and add documentation for any new endpoints.
88
+
89
+ License
90
+ MIT © Suman Jangili. See the LICENSE file for full terms.
91
+
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
95
+
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.6",
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
  }