{"_id":"@siva_raja/uxsp","_rev":"3-6d45d6ac1a1b2bc6f47d491330772d24","name":"@siva_raja/uxsp","dist-tags":{"latest":"1.3.0"},"versions":{"1.1.0":{"name":"@siva_raja/uxsp","version":"1.1.0","keywords":["uxsp","post-quantum","encryption","browser-sdk","security"],"author":{"name":"SIVA RAJA S"},"license":"MIT","_id":"@siva_raja/uxsp@1.1.0","maintainers":[{"name":"siva_raja","email":"sivaraja5401@gmail.com"}],"dist":{"shasum":"9e827ed5ba02f01a7b11ef228459123cfe61279f","tarball":"https://registry.npmjs.org/@siva_raja/uxsp/-/uxsp-1.1.0.tgz","fileCount":18,"integrity":"sha512-v9AOEm+Sgryhtszv1HD5Exn8oUqV8jA0uuRU/HsNT2zpvyuewG0EaAVGH7cJdr7GNugo2hLE3g0EGDNYl7Xesw==","signatures":[{"sig":"MEUCIHz48A0AfgmoERne3p/QLy6HZRTuaWT6jxjfmI4uOPP1AiEAuIN6APcAGvltfWWTMDiTtrgVS2l+RV3oaw7LP60NI4M=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":18311},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"f43eb2a2c8f3a22f9d4daca8102601bdbd3453fa","scripts":{"test":"node --test","build":"tsc"},"_npmUser":{"name":"siva_raja","email":"sivaraja5401@gmail.com"},"_npmVersion":"11.19.0","description":"UXSP (Ultra Secure Protocol) JavaScript/TypeScript Browser SDK","directories":{},"_nodeVersion":"26.7.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/uxsp_1.1.0_1787732860663_0.23358405507809255","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@siva_raja/uxsp","version":"1.2.0","keywords":["uxsp","post-quantum","encryption","browser-sdk","security"],"author":{"name":"SIVA RAJA S"},"license":"MIT","_id":"@siva_raja/uxsp@1.2.0","maintainers":[{"name":"siva_raja","email":"sivaraja5401@gmail.com"}],"dist":{"shasum":"f6d175c74692853b9f09095be127ca39ad674ce1","tarball":"https://registry.npmjs.org/@siva_raja/uxsp/-/uxsp-1.2.0.tgz","fileCount":52,"integrity":"sha512-kJTjkoF8OF3ZMl3y4laiAy3dhMqiifcKzwH0pkeaU6Hj3WwIbpnlG8uXZ6gvIkxGqYDvJCiVoaz8uwLXrNg8IQ==","signatures":[{"sig":"MEYCIQDIfYkx7gWC9zZXF/4VGgIYZ/J7uBeMqq5MgNewePqZpwIhAPR1M9jF4wAXN0zPpP7Fm/b9qIlsdJQM0y9hWFz+andv","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDKLxKRilBUmwJrFWSnQjOuEcbPoywctByTv7xFLGx3pAIgawtHapO7YyRUhttV41QKKHieuRcDWLZPWgrqOLr1cc8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":108678},"main":"dist/index.js","types":"dist/index.d.ts","module":"dist/index.mjs","gitHead":"b1ccb2f28fec95feac0490ffbe91eb223257b2c4","scripts":{"test":"npx tsx --test tests/**/*.test.ts","build":"tsc"},"_npmUser":{"name":"siva_raja","email":"sivaraja5401@gmail.com"},"_npmVersion":"11.19.0","description":"UXSP JavaScript/TypeScript Browser SDK","directories":{},"_nodeVersion":"26.7.0","dependencies":{"@oqs/liboqs-js":"^0.15.1"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^26.4.0"},"_npmOperationalInternal":{"tmp":"tmp/uxsp_1.2.0_1788003062609_0.4725269669634369","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"_id":"@siva_raja/uxsp@1.3.0","bugs":{"url":"https://github.com/SIVA-RAJA/uxsp/issues"},"dist":{"shasum":"98382f308af265e3b7d1818964e8d548f17cca9e","tarball":"https://registry.npmjs.org/@siva_raja/uxsp/-/uxsp-1.3.0.tgz","fileCount":69,"integrity":"sha512-K5Yd6A5b3ZG30uYoMe8FnNQkb2yuprYNd6IDC6YpZoWExxSoZFnfpzCITckaGQakK8JQDm5Y0eOdo3aEL0v6aw==","signatures":[{"sig":"MEUCIBAsySoFIFdIr2mIjnUyGvsHGaAn7V/0gD8ocddXIt5LAiEA40IUhNQlLgzFq0kQAs8TLVSqzXaNzF+EBvjNtOagvL0=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDLkvoIxYijePyQ3akkmzF+LkOE5YpMhX2tqJAlBt5d+AiEAmIj+IIhrIxtxUxRpKLzD4wFzLA+ithd+oAoeiKxu0yM="}],"unpackedSize":237865},"main":"dist/index.js","name":"@siva_raja/uxsp","type":"module","types":"dist/index.d.ts","author":{"name":"SIVA RAJA S"},"module":"dist/index.mjs","gitHead":"cbef0939ef0095db41d0777cbecfc351458efae1","license":"MIT","scripts":{"test":"tsc && node --experimental-strip-types --test tests/*.test.ts","build":"tsc"},"version":"1.3.0","_npmUser":{"name":"siva_raja","email":"sivaraja5401@gmail.com"},"homepage":"https://github.com/SIVA-RAJA/uxsp#readme","keywords":["uxsp","post-quantum","encryption","browser-sdk","security"],"repository":{"url":"git+https://github.com/SIVA-RAJA/uxsp.git","type":"git"},"_npmVersion":"11.19.0","description":"UXSP JavaScript/TypeScript Browser SDK","directories":{},"maintainers":[{"name":"siva_raja","email":"sivaraja5401@gmail.com"}],"_nodeVersion":"26.7.0","dependencies":{"@oqs/liboqs-js":"^0.15.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/node":"^26.4.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/uxsp_1.3.0_1789291043564_0.8882109613663307"}}},"time":{"created":"2026-08-26T08:27:40.500Z","modified":"2026-09-13T09:17:23.804Z","1.1.0":"2026-08-26T08:27:40.806Z","1.2.0":"2026-08-29T11:31:02.707Z","1.3.0":"2026-09-13T09:17:23.665Z"},"author":{"name":"SIVA RAJA S"},"license":"MIT","keywords":["uxsp","post-quantum","encryption","browser-sdk","security"],"description":"UXSP JavaScript/TypeScript Browser SDK","maintainers":[{"name":"siva_raja","email":"sivaraja5401@gmail.com"}],"readme":"# @siva_raja/uxsp\n\n[![NPM Version](https://img.shields.io/npm/v/@siva_raja/uxsp.svg?color=blue)](https://www.npmjs.com/package/@siva_raja/uxsp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-Strict-blue)](https://www.typescriptlang.org/)\n[![NIST Post-Quantum](https://img.shields.io/badge/NIST-ML--KEM--768%20%7C%20ML--DSA--65-blueviolet)](https://csrc.nist.gov/)\n\n**Universal Exchange Security Protocol (UXSP) JavaScript/TypeScript SDK** brings military-grade, hybrid post-quantum cryptography directly to Web Browsers and Node.js environments.\n\nProtect client-side data, web APIs, and real-time WebSockets before information ever touches the network.\n\n---\n\n## What is UXSP?\n\nMost websites today encrypt data with TLS/HTTPS. But TLS only protects data *in transit between your browser and the cloud load balancer*. Once it hits the server or CDN, it sits unencrypted in memory.\n\nEven worse, upcoming **Quantum Computers** will break today's encryption (RSA and ECC). Malicious actors are already capturing encrypted traffic today (\"Harvest Now, Decrypt Later\") to unlock it in the future.\n\n**UXSP solves this right inside your frontend:**\n- 🔒 **End-to-End Application Layer Encryption**: Data is sealed inside the browser and can only be opened by the destination server or peer.\n- 🛡️ **Double-Locked Hybrid Armor**: Combines battle-tested classical cryptography (**X25519** + **Ed25519** + **AES-256-GCM**) with NIST-approved Post-Quantum lattice cryptography (**ML-KEM-768** + **ML-DSA-65**).\n- 🔄 **Drop-In `uxspFetch`**: Automatically detects whether a backend supports UXSP. If yes, it encrypts the request; if no, it seamlessly falls back to standard HTTP!\n\n---\n\n## 📦 Installation\n\n```bash\n# Using npm\nnpm install @siva_raja/uxsp\n\n# Using pnpm\npnpm add @siva_raja/uxsp\n\n# Using yarn\nyarn add @siva_raja/uxsp\n```\n\n---\n\n## ⚙️ Bundler Setup (Vite, Next.js, Webpack)\n\nUXSP leverages modern **WebCrypto** and **WebAssembly** for hardware-accelerated post-quantum primitives.\n\n### Vite (`vite.config.ts`)\n```ts\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n  optimizeDeps: {\n    exclude: ['@siva_raja/uxsp']\n  }\n});\n```\n\n### Next.js (`next.config.js`)\n```js\n/** @type {import('next').NextConfig} */\nconst nextConfig = {\n  webpack: (config) => {\n    config.experiments = { ...config.experiments, asyncWebAssembly: true };\n    return config;\n  },\n};\nmodule.exports = nextConfig;\n```\n\n---\n\n## 🚀 5-Minute Tutorial & Code Examples\n\n### 1. Generating & Exporting Identities\n\nEvery browser client creates an `Identity` (with private keys) and a public `PublicCard`:\n\n```ts\nimport { Identity } from \"@siva_raja/uxsp\";\n\n// 1. Generate a new identity for the user\nconst alice = await Identity.generate(\"AliceClient\", \"client\");\n\n// 2. Extract Alice's PublicCard (shareable with the backend/peers)\nconst aliceCard = alice.publicCard();\nconsole.log(\"Alice ID:\", aliceCard.entity_id);\n\n// 3. Save Alice's identity safely in browser localStorage (encrypted with user password)\nconst encryptedBlob = await alice.toEncryptedJson(\"UserSecretPassword123!\");\nlocalStorage.setItem(\"uxsp_identity\", encryptedBlob);\n\n// 4. Restore identity later\nconst restored = await Identity.fromEncryptedJson(\n  localStorage.getItem(\"uxsp_identity\")!,\n  \"UserSecretPassword123!\"\n);\n```\n\n---\n\n### 2. Drop-In `uxspFetch` (Automatic Protocol Switching & Fallback)\n\n`uxspFetch` is a drop-in replacement for the browser's native `window.fetch`. It automatically probes the destination server:\n- If the server has UXSP middleware $\\to$ automatically encrypts the request payload and decrypts the response.\n- If the server is standard REST (e.g., Stripe, public APIs) $\\to$ automatically falls back to standard plaintext HTTPS!\n\n```ts\nimport { uxspFetch, configureUXSPFetch, Identity } from \"@siva_raja/uxsp\";\n\nconst alice = await Identity.generate(\"AliceClient\");\n\n// Configure default identity and fallback options\nconfigureUXSPFetch({\n  identity: alice,\n  allowFallback: true // Enables progressive web migration\n});\n\n// Example 1: Talking to a UXSP-protected backend (FastAPI / Django / Flask)\n// The request body is automatically encrypted; the response is automatically decrypted!\nconst secureResponse = await uxspFetch(\"https://api.myapp.com/v1/checkout\", {\n  method: \"POST\",\n  headers: { \"Content-Type\": \"application/json\" },\n  body: JSON.stringify({ item: \"Laptop\", price: 1200 })\n});\n\nconsole.log(\"Encrypted with Post-Quantum armor?\", secureResponse.isEncrypted);\nconst data = await secureResponse.json();\nconsole.log(\"Decrypted response:\", data);\n\n// Example 2: Talking to a legacy third-party API (e.g. GitHub or Stripe)\n// Server does not support UXSP -> uxspFetch seamlessly falls back to standard fetch!\nconst publicResponse = await uxspFetch(\"https://api.github.com/zen\");\nconsole.log(\"Encrypted?\", publicResponse.isEncrypted); // false\nconsole.log(\"Plaintext text:\", await publicResponse.text());\n```\n\n---\n\n### 3. High-Level 1-Line Encryption (`SendText` / `ReceiveText`)\n\nEncrypt messages directly for peer-to-peer or WebSocket dispatch:\n\n```ts\nimport { configure, setIdentity, SendText, ReceiveText, Identity } from \"@siva_raja/uxsp\";\n\nconst alice = await Identity.generate(\"Alice\");\nconst bob = await Identity.generate(\"Bob\");\n\n// Alice sends confidential text to Bob\nconst packageObj = await SendText({\n  text: \"Confidential coordinates: 48.8584° N, 2.2945° E\",\n  receiver: bob.publicCard(),\n  sender: alice\n});\n\n// Bob decrypts the package\nconst plainText = await ReceiveText({\n  package: packageObj,\n  sender: alice.publicCard(),\n  receiver: bob\n});\n\nconsole.log(plainText);\n// Output: \"Confidential coordinates: 48.8584° N, 2.2945° E\"\n```\n\n---\n\n### 4. Real-Time Encrypted WebSockets\n\nSecure live bi-directional messaging with monotonic frame sequencing and sliding-window replay protection:\n\n```ts\nimport { UXSPWebSocket, Identity } from \"@siva_raja/uxsp\";\n\nconst client = await Identity.generate(\"BrowserUser\");\nconst ws = new WebSocket(\"wss://api.myapp.com/live-stream\");\n\nconst uxspWs = UXSPWebSocket.asInitiator(client);\n\nws.onopen = async () => {\n  // 1. Complete 3-step mutual Post-Quantum handshake\n  const helloFrame = await uxspWs.createHello();\n  ws.send(JSON.stringify(helloFrame));\n};\n\nws.onmessage = async (event) => {\n  const frame = JSON.parse(event.data);\n\n  if (frame.type === \"HELLO_ACK\") {\n    const completeFrame = await uxspWs.handleHelloAck(frame);\n    ws.send(JSON.stringify(completeFrame));\n    console.log(\"Secure Post-Quantum Session Established!\");\n  } else if (frame.type === \"DATA\") {\n    // Decrypt real-time data frame\n    const plaintext = await uxspWs.decryptFrame(frame);\n    console.log(\"Live stream frame received:\", plaintext);\n  }\n};\n```\n\n---\n\n### 5. Low-Level Direct Sealing (`seal` / `openSeal`)\n\nFor custom protocol designers and low-level envelope control:\n\n```ts\nimport { seal, openSeal, Identity } from \"@siva_raja/uxsp\";\n\nconst alice = await Identity.generate(\"Alice\");\nconst bob = await Identity.generate(\"Bob\");\n\nconst rawBytes = new TextEncoder().encode(\"Low level binary payload\");\n\n// Seal directly into a UXSP Envelope\nconst envelope = await seal(alice, bob.publicCard(), rawBytes);\n\n// Bob opens and verifies envelope\nconst decryptedBytes = await openSeal(bob, alice.publicCard(), envelope);\nconsole.log(new TextDecoder().decode(decryptedBytes));\n```\n\n---\n\n## 🛡️ Supported Cryptographic Algorithms\n\n| Component | Standard | Primitive |\n| :--- | :--- | :--- |\n| Classical Key Encapsulation | RFC 7748 | **X25519 (ECDH)** |\n| Post-Quantum Key Encapsulation | NIST FIPS 203 | **ML-KEM-768 (CRYSTALS-Kyber)** |\n| Classical Digital Signature | RFC 8032 | **Ed25519** |\n| Post-Quantum Digital Signature | NIST FIPS 204 | **ML-DSA-65 (CRYSTALS-Dilithium)** |\n| Symmetric AEAD Encryption | RFC 5116 | **AES-256-GCM** |\n| Key Derivation Function | RFC 5869 | **HKDF-SHA256** |\n| Password Key Hashing | RFC 9106 | **Argon2id** |\n\n---\n\n## 📚 Related Resources\n\n- 🐍 **[UXSP Python Core Engine](https://github.com/SIVA-RAJA/uxsp)**: The primary Python implementation and framework middlewares.\n- 📜 **[Formal Protocol Specification](https://github.com/SIVA-RAJA/uxsp/blob/main/docs/protocol_specification.md)**: RFC 2119 specifications and security proofs.\n- ⚡ **[Exact Wire Format Standard](https://github.com/SIVA-RAJA/uxsp/blob/main/docs/wire_format.md)**: Bit-by-bit wire framing.\n- 📖 **[Developer Tutorials](https://github.com/SIVA-RAJA/uxsp/tree/main/tutorial)**: Comprehensive backend and frontend integration guides.\n\n---\n\n## 📄 License\n\nMIT License — Copyright (c) 2026 SIVA RAJA S.\n","readmeFilename":"README.md","homepage":"https://github.com/SIVA-RAJA/uxsp#readme","repository":{"url":"git+https://github.com/SIVA-RAJA/uxsp.git","type":"git"},"bugs":{"url":"https://github.com/SIVA-RAJA/uxsp/issues"}}