Skip to content

AdhwaithAS/OneBurn

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”₯ OneBurn

OneBurn is a simple yet powerful open-source API that allows you to generate one-time self-destructing links for sensitive secrets (passwords, tokens, notes, etc.). Secrets can be optionally protected with an IP address and a password.

πŸ“¦ Lightweight | πŸ”’ Secure | 🧨 Burn-After-Read | ☁️ Redis-backed


🌐 Live Demo

https://oneburn.vercel.app/

πŸš€ Features

  • πŸ” One-time viewing β€” auto-deletes secret after first access.
  • 🌍 IP restriction β€” allow viewing from a specific IP only.
  • πŸ”‘ Password protection β€” require password to unlock secret.
  • ⏱️ TTL (Time-to-Live) β€” secret automatically expires.
  • ⚑ Fast, stateless API using Redis.
  • 🧱 Built with Node.js + Express + Redis.

πŸ“¦ API Endpoints

βž• POST /api/store

Store a secret and generate a one-time link.

Request Body

{
  "encryptedSecret": "your-encrypted-data",
  "ttl": 300,
  "allowedIp": "123.123.123.123(optional ip)",
  "password": "optionalPassword"
}
Field Type Description
encryptedSecret string The encrypted secret to store (required)
ttl number Time-to-live in seconds (optional, default 300)
allowedIp string IP address allowed to access the secret (optional)
password string Password required to unlock the secret (optional)

Response

{
  "link": "http://localhost:3001/api/view/your-token"
}

πŸ‘οΈ POST /api/view/:token

Retrieve and delete a one-time secret.

Request Body

{
  "password": "optionalPassword"
}
Field Type Description
password string Required only if the secret is password protected

Success Response

{
  "encryptedSecret": "your-encrypted-data"
}

Error Responses

Code Message
404 Secret already viewed or expired
403 IP address not allowed or wrong password
401 Password required
500 Server/internal error

βš™οΈ Environment Variables

Create a .env file in the root directory:

PORT=3001
API_KEY=your_super_secret_api_key
REDIS_URL=redis://localhost:6379
  • API_KEY: Required for API authentication.
  • REDIS_URL: (Optional) Redis Cloud or local instance.

πŸ› οΈ Installation & Running

1. Clone and Setup

git clone https://github.com/yourusername/oneburn.git
cd oneburn
npm install
cp .env.example .env

2. Configure .env

Edit .env with your own values for API_KEY, PORT, and optionally REDIS_URL.

3. Start the Server

npm start

Server runs at http://localhost:3001


πŸ” Authentication

All API requests must include the API key in headers:

Authorization: Bearer your_api_key

πŸ“ File Structure

oneburn/
β”œβ”€β”€ auth.js
β”œβ”€β”€ server.js
β”œβ”€β”€ .env
β”œβ”€β”€ .gitignore
β”œβ”€β”€ README.md
└── package.json

πŸ§ͺ Example Usage with cURL

Store Secret

curl -X POST http://localhost:3001/api/store \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"encryptedSecret":"hello world","ttl":600,"password":"1234"}'

View Secret

curl -X POST http://localhost:3001/api/view/<token> \
  -H "Authorization: Bearer your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"password":"1234"}'

🧰 Tech Stack

  • Node.js
  • Express.js
  • Redis (Cloud or Local)
  • dotenv
  • uuid
  • crypto

🀝 Contributing

  1. Fork the repo
  2. Create your branch: git checkout -b feature/your-feature
  3. Commit your changes: git commit -m "Add your feature"
  4. Push to the branch: git push origin feature/your-feature
  5. Open a Pull Request

🧾 License

MIT License

MIT License

Copyright (c) 2025 AdhwaithAS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

πŸ”₯ One-time secret sharing API with burn-after-read, password & IP protection.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published