{"_id":"402","_rev":"9-45e6ea7ac91a4b16b19016d7a753e373","name":"402","dist-tags":{"latest":"0.1.1"},"versions":{"0.0.2":{"name":"402","version":"0.0.2","keywords":["402","payments"],"author":{"url":"https://melvincarvalho.com/#me","name":"Melvin Carvalho","email":"melvincarvalho@gmail.com"},"license":"MIT","_id":"402@0.0.2","maintainers":[{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"}],"homepage":"https://github.com/melvincarvalho/402#readme","bugs":{"url":"https://github.com/melvincarvalho/402/issues"},"dist":{"shasum":"956758ed6a577932a2073ff8c150963ab6437476","tarball":"https://registry.npmjs.org/402/-/402-0.0.2.tgz","integrity":"sha512-IepsIi90PBYwC38JoZ/3Tao/9OTHsWBZ7+pUISPBv1+3TjHNODRMTpu0I+zUFTJGtzrBRYXOHJvQJpmcP2qamQ==","signatures":[{"sig":"MEYCIQC2CIYsOwxh+XOdIgKAk9UImioz4BkO2H4RCmYbUwqqvQIhAMjzDRdC0ieiC6TzzCK9fryc/DBC7SAIML3Kn92spq2N","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"956758ed6a577932a2073ff8c150963ab6437476","gitHead":"79b3e0eda662f39522c660d826684922d9150d3e","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"},"repository":{"url":"git+https://github.com/melvincarvalho/402.git","type":"git"},"_npmVersion":"3.5.2","description":"402 payments","_nodeVersion":"4.2.6","dependencies":{"cors":"^2.7.1","vhost":"^3.0.2","webid":"^0.3.7","express":"^4.13.4","commander":"^2.9.0","sequelize":"^3.23.2","dateformat":"^1.0.12","http-error":"0.0.6","body-parser":"^1.15.1","express-session":"^1.13.0"},"_npmOperationalInternal":{"tmp":"tmp/402-0.0.2.tgz_1463751118103_0.3339388738386333","host":"packages-12-west.internal.npmjs.com"},"directories":{}},"0.0.3":{"name":"402","version":"0.0.3","keywords":["402","payments"],"author":{"url":"https://melvincarvalho.com/#me","name":"Melvin Carvalho","email":"melvincarvalho@gmail.com"},"license":"MIT","_id":"402@0.0.3","maintainers":[{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"}],"homepage":"https://github.com/melvincarvalho/402#readme","bugs":{"url":"https://github.com/melvincarvalho/402/issues"},"dist":{"shasum":"cf29be6ad2dc9440e461710a14d14fd4e32d9557","tarball":"https://registry.npmjs.org/402/-/402-0.0.3.tgz","integrity":"sha512-k1MY+lCvEfZm2eLDjZG1y0Jm0BfDsfsL+OZrZRuLCxp97wBT+k5FmQOk4RomxonKFLkZ0XJ+jV6VW1atLMy1uA==","signatures":[{"sig":"MEYCIQCPjVestZ2lIYRD0MDwbj/qV49TVX6UAFo7TZME/LJlFQIhAPF6L4Dq9YdqqiaH1TRgh/Ip+gqVe8Ha5GZckvooiDtv","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"cf29be6ad2dc9440e461710a14d14fd4e32d9557","gitHead":"6b6229f6dd3878d244de8d38ae5e3b5cb23aa3ba","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"},"repository":{"url":"git+https://github.com/melvincarvalho/402.git","type":"git"},"_npmVersion":"3.5.2","description":"402 payments","_nodeVersion":"4.2.6","dependencies":{"cors":"^2.7.1","vhost":"^3.0.2","webid":"^0.3.7","express":"^4.13.4","commander":"^2.9.0","sequelize":"^3.23.2","dateformat":"^1.0.12","http-error":"0.0.6","webcredits":"^0.1.8","body-parser":"^1.15.1","express-session":"^1.13.0"},"_npmOperationalInternal":{"tmp":"tmp/402-0.0.3.tgz_1463761446634_0.45212837774306536","host":"packages-12-west.internal.npmjs.com"},"directories":{}},"0.0.5":{"name":"402","version":"0.0.5","keywords":["402","payments"],"author":{"url":"https://melvincarvalho.com/#me","name":"Melvin Carvalho","email":"melvincarvalho@gmail.com"},"license":"MIT","_id":"402@0.0.5","maintainers":[{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"}],"homepage":"https://github.com/melvincarvalho/402#readme","bugs":{"url":"https://github.com/melvincarvalho/402/issues"},"dist":{"shasum":"a99f44f73a8d23b4f45a777253618fb89c9ac12d","tarball":"https://registry.npmjs.org/402/-/402-0.0.5.tgz","integrity":"sha512-+2kTTdVUZctnRnLzbD9DJvq1mUlIxLqIddKSyxSeSqKiPGBylJKWHhCri+mqgPbQzv+gPPMFlPNHw2ITMhg4jA==","signatures":[{"sig":"MEYCIQCA0fLUR74kmTjKed2QlOtOFImiUfkN5ILEbjSYgCDiXgIhAMy7gsCcChduJtpVKQn3Lqt022fMvqxbsMK+Jsl1pVWO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"a99f44f73a8d23b4f45a777253618fb89c9ac12d","gitHead":"9eba8e803fedb1bfe6f7767423bb6a940e785707","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"},"repository":{"url":"git+https://github.com/melvincarvalho/402.git","type":"git"},"_npmVersion":"3.8.6","description":"402 payments","_nodeVersion":"6.1.0","dependencies":{"cors":"^2.7.1","vhost":"^3.0.2","webid":"^0.3.7","express":"^4.13.4","commander":"^2.9.0","sequelize":"^3.23.2","dateformat":"^1.0.12","http-error":"0.0.6","webcredits":"^0.1.8","body-parser":"^1.15.1","express-session":"^1.13.0"},"_npmOperationalInternal":{"tmp":"tmp/402-0.0.5.tgz_1463824326831_0.42993351188488305","host":"packages-12-west.internal.npmjs.com"},"directories":{}},"0.0.6":{"name":"402","version":"0.0.6","keywords":["402","payments"],"author":{"url":"https://melvincarvalho.com/#me","name":"Melvin Carvalho","email":"melvincarvalho@gmail.com"},"license":"MIT","_id":"402@0.0.6","maintainers":[{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"}],"homepage":"https://github.com/melvincarvalho/402#readme","bugs":{"url":"https://github.com/melvincarvalho/402/issues"},"dist":{"shasum":"a6d4ecf6b1aafb3bb3a8e6e5ea2e872ed14be25b","tarball":"https://registry.npmjs.org/402/-/402-0.0.6.tgz","integrity":"sha512-f0qr4M3UDarehyqsqofI7wAIR/YZUMA7RrDm7UWitGkdOigDEXns3YuI+1VPYfZ6bUJJMWI+1OEE7UBKyxsKnw==","signatures":[{"sig":"MEQCIB7ZctMGGgg0HdZSMrKM/OZaMMfnuARSHc42r8N4bfWOAiALkjzMnzkzDI3saCQcsD0ef8TcoCcqTMmB/frzFgPajQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"a6d4ecf6b1aafb3bb3a8e6e5ea2e872ed14be25b","gitHead":"acd03fd6454044de9e9e1388fa455225629eabcc","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"},"repository":{"url":"git+https://github.com/melvincarvalho/402.git","type":"git"},"_npmVersion":"3.8.6","description":"402 payments","_nodeVersion":"6.1.0","dependencies":{"cors":"^2.7.1","vhost":"^3.0.2","webid":"^0.3.7","express":"^4.13.4","commander":"^2.9.0","sequelize":"^3.23.2","dateformat":"^1.0.12","http-error":"0.0.6","webcredits":"^0.1.8","body-parser":"^1.15.1","express-session":"^1.13.0"},"_npmOperationalInternal":{"tmp":"tmp/402-0.0.6.tgz_1463825333807_0.8723835092969239","host":"packages-12-west.internal.npmjs.com"},"directories":{}},"0.1.0":{"name":"402","version":"0.1.0","keywords":["402","payments"],"author":{"url":"https://melvincarvalho.com/#me","name":"Melvin Carvalho","email":"melvincarvalho@gmail.com"},"license":"MIT","_id":"402@0.1.0","maintainers":[{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"}],"homepage":"https://github.com/melvincarvalho/402#readme","bugs":{"url":"https://github.com/melvincarvalho/402/issues"},"dist":{"shasum":"d5c3954ca2b47813ce403bef0889b1674db6e124","tarball":"https://registry.npmjs.org/402/-/402-0.1.0.tgz","integrity":"sha512-gnFH1tfzdcpfjCGeduPKNA5rKKoqvMb1NUfuxN0OD8Pu5xAt3X1DW0Nqooy4FCHRRMFxXGeW8mbmQvCcZday7w==","signatures":[{"sig":"MEQCIBLrwPIjuRU8z90QrEL0C8jlBKLFZByCGtP/91c/zd9xAiA+kdjIFPrGpTZhfj0+L/sKrnkka+cPvK0EIaMtolh7lg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"d5c3954ca2b47813ce403bef0889b1674db6e124","gitHead":"44a7a79fadbf34909fa035880628dee8b55243b2","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"},"repository":{"url":"git+https://github.com/melvincarvalho/402.git","type":"git"},"_npmVersion":"3.8.6","description":"402 payments","_nodeVersion":"6.1.0","dependencies":{"cors":"^2.7.1","vhost":"^3.0.2","webid":"^0.3.7","express":"^4.13.4","commander":"^2.9.0","sequelize":"^3.23.2","dateformat":"^1.0.12","http-error":"0.0.6","webcredits":"^0.1.10","body-parser":"^1.15.1","express-session":"^1.13.0"},"_npmOperationalInternal":{"tmp":"tmp/402-0.1.0.tgz_1463832402586_0.20400303904898465","host":"packages-16-east.internal.npmjs.com"},"directories":{}},"0.1.1":{"name":"402","version":"0.1.1","description":"402 payments","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/melvincarvalho/402.git"},"keywords":["402","payments"],"author":{"name":"Melvin Carvalho","email":"melvincarvalho@gmail.com","url":"https://melvincarvalho.com/#me"},"license":"MIT","bugs":{"url":"https://github.com/melvincarvalho/402/issues"},"homepage":"https://github.com/melvincarvalho/402#readme","dependencies":{"body-parser":"^1.15.1","commander":"^2.9.0","cors":"^2.7.1","dateformat":"^1.0.12","express":"^4.13.4","express-session":"^1.13.0","http-error":"0.0.6","sequelize":"^3.23.2","vhost":"^3.0.2","webcredits":"^0.1.10","webid":"^0.3.7"},"_id":"402@0.1.1","gitHead":"470c4accca516c3a5f5698d83c9d5478f333f338","_nodeVersion":"24.5.0","_npmVersion":"11.5.1","dist":{"integrity":"sha512-4ohGJaJDyHqlMMHqsBxd1YzjY4b6eThl9+Bc2bgJTKOqoAcH/uwXxGOHc6rNLzVPb4J3D0wekFp8/5mApclGVA==","shasum":"45948f2169b025ab0ebdaf2b21678470b03e22fe","tarball":"https://registry.npmjs.org/402/-/402-0.1.1.tgz","fileCount":26,"unpackedSize":794809,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIG6JmXiSc0Es3CCO9mKipLFHHwu9AUiX4nGnKfDlpHgaAiAM0u6wPAv/vKqK49LcR9+fopLfxWB8f4s+4kbWtDzdDA=="}]},"_npmUser":{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"},"directories":{},"maintainers":[{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/402_0.1.1_1761607004411_0.9995627979304877"},"_hasShrinkwrap":false}},"time":{"created":"2016-05-20T13:32:00.642Z","modified":"2025-10-27T23:16:44.916Z","0.0.2":"2016-05-20T13:32:00.642Z","0.0.3":"2016-05-20T16:24:09.167Z","0.0.5":"2016-05-21T09:52:09.533Z","0.0.6":"2016-05-21T10:08:56.571Z","0.1.0":"2016-05-21T12:06:43.601Z","0.1.1":"2025-10-27T23:16:44.704Z"},"bugs":{"url":"https://github.com/melvincarvalho/402/issues"},"author":{"name":"Melvin Carvalho","email":"melvincarvalho@gmail.com","url":"https://melvincarvalho.com/#me"},"license":"MIT","homepage":"https://github.com/melvincarvalho/402#readme","keywords":["402","payments"],"repository":{"type":"git","url":"git+https://github.com/melvincarvalho/402.git"},"description":"402 payments","maintainers":[{"name":"melvincarvalho","email":"melvincarvalho@gmail.com"}],"readme":"## Introduction\n\n**Note: This repository contains experimental work from 2016 implementing HTTP 402 with Solid. We are now exploring modern HTTP 402 implementations and standards for R&D purposes.**\n\nFor today's hackday I am going to try and start to build an access controlled \"route\" in solid-server, which grants access to a resource based on a credit system.  If you have credits, it will show you the resource.  If not you will get a 402.  This builds a bit more functionality on the code written for the previous [hack day](http://melvincarvalho.github.io/markdown-editor/?uri=https://melvin.databox.me/.markdown/hackday/route.txt).  I'll try and incorporate the work from the web payments WG [http://w3c.github.io/webpayments-http-api/](http://w3c.github.io/webpayments-http-api/).\n\n## Modern HTTP 402 Implementations (2025)\n\nThe HTTP 402 \"Payment Required\" status code, long dormant since HTTP/1.1, has seen significant adoption in 2025. Here are notable projects and standards:\n\n### x402 Protocol\n- **Description**: Open protocol by Coinbase that enables blockchain-based payments over HTTP\n- **Partners**: Cloudflare, Visa, Google, AWS, Anthropic, Circle, Vercel\n- **Documentation**: https://x402.gitbook.io/x402/core-concepts/client-server\n- **Foundation**: x402 Foundation (Coinbase + Cloudflare)\n- **Use Cases**: AI agent payments, API monetization, autonomous commerce\n- **Stats**: 1.38M+ transactions, $1.48M+ volume (as of Oct 2025)\n\n### Cloudflare Pay Per Crawl\n- **Description**: HTTP 402 implementation for AI crawler monetization\n- **Documentation**: https://developers.cloudflare.com/agents/x402/\n- **Features**: Per-request pricing for AI bots accessing web content\n- **Scale**: 1 billion+ HTTP 402 responses daily\n\n### L402 Protocol (Lightning Labs)\n- **Description**: Lightning Network-based HTTP 402 implementation (formerly LSAT)\n- **GitHub**: https://github.com/lightninglabs/L402\n- **Documentation**: https://docs.lightning.engineering/the-lightning-network/l402\n- **Tools**: Aperture (reverse proxy), LangChainL402 (AI integration)\n- **Use Cases**: Pay-per-use APIs, micropayments, Lightning Loop/Pool\n\n### Related Projects\n- **Aperture**: L402 reverse HTTP proxy for paid APIs\n- **@bus402/x402-sandbox**: NPM package for local x402 testing\n- **Visa TAP**: Trusted Agent Protocol supporting x402\n- **PING Token**: First token experiment on x402 protocol (Base chain)\n\n### Resources\n- MDN HTTP 402 Documentation: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/402\n- awesome-L402: https://github.com/Fewsats/awesome-L402  \n\n\n## Components\n\nThe demo contains 4 components\n\n* /pay -- the resource that costs 25 credits to view\n* /balance -- shows your balance\n* /faucet -- a small app that will see your balance\n* /home -- navigation and instructions\n\nEach was deployed as a custom route with its own handler.  \n\n## Installation\n\nInstallation is via\n\n    git clone https://github.com/melvincarvalho/402.git\n\nThen run\n\n    npm install\n\n\n```bash\n$ bin/server.js  --port 8443 --ssl-key path/to/ssl-key.pem --ssl-cert path/to/ssl-cert.pem\n# server running on https://localhost:8443/\n```\n\n##### How do I get the --ssl-key and the --ssl-cert?\nYou need an SSL certificate you get this from your domain provider or for free from [Let's Encrypt!](https://letsencrypt.org/getting-started/).\n\nIf you don't have one yet, or you just want to test `solid`, generate a certificate\n```\n$ openssl genrsa 2048 > ../localhost.key\n$ openssl req -new -x509 -nodes -sha256 -days 3650 -key ../localhost.key -subj '/CN=*.localhost' > ../localhost.cert\n```\n\n## Faucet\n\nUsing [webcredits](https://webcredits.org/) it is possible to set up a faucet using\n\n    credit create\n\n    credit genesis\n\n    credit insert https://w3id.org/cc#coinbase 50000 '' https://w3id.org/cc#faucet\n\n\n## Demo\n\n[Demo](https://webcredits.org:3000/)\n","readmeFilename":"README.md"}