Catalog npm
Back to packageRELEASE DETAILS

1.0.0

npm

0cert-middleware

Drop-in Express middleware for 0Cert identity-based encryption. Zero certificates. Zero renewals.

0certcertificatelessencryptionexpressibcidentity-based-cryptographymiddlewaresecurityssl-replacement
Published15 Jun 2026
Direct dependencies0
Transitive dependenciesNot calculated

README

Current package documentation

0cert-middleware

Drop-in Express middleware for 0Cert — identity-based encryption for Node.js.
Zero certificates. Zero renewals. Zero CAs.


Install

npm install 0cert-middleware

Usage

const express   = require('express')
const zerocert  = require('0cert-middleware')

const app = express()

app.use(zerocert({
  identity:    'mysite.com',               // your domain
  fullPrivKey: process.env.IBC_PRIV_KEY,   // from 0 Browser app or KGC API
  userSecret:  process.env.IBC_USER_SECRET, // generated during key setup
  kgc:         'https://kgc.0cert.io'      // public KGC (or your own)
}))

app.get('/', (req, res) => {
  res.send('Hello! This site is 0Cert protected.')
})

app.listen(3000)

That's it. Your site now:

  • Serves /.well-known/0cert — verified by 0 Browser automatically
  • Adds X-0Cert-* headers to all responses
  • Shows 0Cert Verified badge to 0 Browser users

Get your keys

Option 1 — 0 Browser app (easiest)

  1. Download 0 Browser on iOS
  2. Go to My Sites tab → tap +
  3. Enter your domain
  4. Copy the keys shown

Option 2 — KGC API directly

# 1. Generate user secret
curl -X POST https://kgc.0cert.io/user/generate-secret

# 2. Issue partial key for your domain
curl -X POST https://kgc.0cert.io/issue-partial-key \
  -H "Content-Type: application/json" \
  -d '{"identity": "mysite.com"}'

# 3. Combine keys
curl -X POST https://kgc.0cert.io/user/combine-keys \
  -H "Content-Type: application/json" \
  -d '{
    "identity": "mysite.com",
    "partialKey": "...",
    "userSecret": "..."
  }'

Store the keys as environment variables:

IBC_PRIV_KEY=your_full_priv_key
IBC_USER_SECRET=your_user_secret

Add DNS TXT record

In your domain registrar, add:

TXT  @  ibc-kgc=https://kgc.0cert.io

This tells 0 Browser which KGC to use for your domain.


Options

zerocert({
  // Required
  identity:    'mysite.com',
  fullPrivKey: '...',
  userSecret:  '...',

  // Optional
  kgc:              'https://kgc.0cert.io', // KGC server URL
  verifyPath:       '/.well-known/0cert',   // verification endpoint path
  verifyOnStartup:  true,                   // verify with KGC on startup
  debug:            false,                  // verbose logging
})

Verification endpoint

The middleware automatically serves /.well-known/0cert:

{
  "ok": true,
  "version": "1.0.0",
  "identity": "mysite.com",
  "kgc": "https://kgc.0cert.io",
  "status": "verified",
  "keyId": "...",
  "algorithm": "CL-PKC-ECDH-v2"
}

0 Browser calls this endpoint when visiting your site to show the verified badge.


Response headers

Added to every response:

X-0Cert-Identity:  mysite.com
X-0Cert-KGC:       https://kgc.0cert.io
X-0Cert-Status:    verified
X-0Cert-Version:   1.0.0
X-0Cert-Algorithm: CL-PKC-ECDH-v2

Decrypt messages (optional)

If you receive encrypted messages via the 0Cert protocol:

const zerocert = require('0cert-middleware')

const config = {
  identity:    'mysite.com',
  fullPrivKey: process.env.IBC_PRIV_KEY,
  userSecret:  process.env.IBC_USER_SECRET,
}

// Decrypt an envelope received from a 0Cert client
const plaintext = zerocert.decrypt(config, envelope)
console.log(plaintext) // → original message

Enterprise / private KGC

Point to your own KGC server:

app.use(zerocert({
  identity:    'mysite.com',
  fullPrivKey: process.env.IBC_PRIV_KEY,
  userSecret:  process.env.IBC_USER_SECRET,
  kgc:         'https://kgc.yourcompany.com', // private KGC
}))

See github.com/0cert/kgc-server to self-host.


How it works

Traditional SSL:
  CA signs certificate → browsers trust ~150 CAs → encrypted connection
  Problem: any CA can fake any certificate

0Cert (CL-PKC):
  KGC issues partial key → you generate user secret → combined = full key
  Encryption uses ECDH P-256 against your public key
  Even the KGC cannot decrypt your traffic

→ Read more at 0cert.io


License

MIT — 0cert.io

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 0

Native requirements
0 direct targetsNot calculated transitive count
No declared dependencies in this collected response

Declarations describe requirements; they are not a resolved dependency graph.

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-InKD/MmyrOQLlfbSH2XbU+9zS9OtVoX3SglkDeFvk+91tcNd5RzbFH2nz8rsmc1XdN4V9nANMOCR+ZhKsHbFvw==",
  "shasum": "6e66ffba62bd70ffa0197391563c71ec81ac560d",
  "tarball": "https://registry.npmjs.org/0cert-middleware/-/0cert-middleware-1.0.0.tgz",
  "fileCount": 4,
  "unpackedSize": 18141,
  "signatures": [
    {
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U",
      "sig": "MEYCIQC9lzd0nLHiOL4RhQsWWjvahG6nzmROmnFCbPgQGue0owIhAJmgg/gFuUsqaq25l0RbCB75FalhevtGLD0P2/Z8Ubs+"
    }
  ]
}

Repository

PENDING
0cert/middleware

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 17:38 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:4257ecbc7dee9684bc4f2fbfbde5aa99d6894b1b7e52d172f638504a8d0b6165

Other collected versions

View all collected versions →