Verus Connect

Add self-sovereign identity login and crypto payments to any website. One package — standalone server, Express middleware, and frontend SDK.

Self-Sovereign Auth
No passwords, no OAuth. Users sign with their VerusID.
Accept Payments
Generate payment QR codes. Scan-to-pay with Verus Mobile.
5 Lines of Code
Install, configure .env, run. That's it.

Setup

Install the package

npm install github:Fried333/verus-connect

Get a VerusID

You need a VerusID to sign login challenges. Create one on Verus Desktop or any VerusID registrar. Export the WIF private key.

Configure

# .env
SIGNING_IADDRESS=iYourVerusIDAddress
PRIVATE_KEY=UxYourWIFPrivateKey
CALLBACK_URL=https://yoursite.com/verusidlogin
PORT=8100

Run

# Standalone sidecar (zero code)
npx verus-connect start

# Or as Express middleware
const { verusAuth } = require('verus-connect/server');
app.use('/auth/verus', verusAuth({
  iAddress: process.env.SIGNING_IADDRESS,
  privateKey: process.env.PRIVATE_KEY,
  callbackUrl: process.env.CALLBACK_URL,
}));

Full Integration Example

Here's a complete working example you can copy into your project. This creates a login button, handles the QR code, polls for the result, and shows the verified identity.

Backend — server.js

const express = require('express');
const { verusAuth } = require('verus-connect/server');

const app = express();
app.use(express.static('public'));

// Mount the VerusID auth middleware
app.use('/verus', verusAuth({
  iAddress: process.env.SIGNING_IADDRESS,
  privateKey: process.env.PRIVATE_KEY,
  callbackUrl: 'https://yoursite.com/verus/verusidlogin',
  // Optional: hook called on successful login
  onLogin: (identity) => {
    console.log(`User logged in: ${identity.friendlyName}`);
    // Create JWT, session, save to DB, etc.
  }
}));

app.listen(3000);

Frontend — public/index.html

<!-- Add a login button and result container -->
<button id="loginBtn">Login with VerusID</button>
<div id="qrBox" style="display:none">
  <canvas id="qr"></canvas>
  <p id="status">Scan with Verus Mobile...</p>
</div>
<div id="welcome" style="display:none"></div>

<!-- QR library (4KB) -->
<script src="https://cdn.jsdelivr.net/npm/qrcode/build/qrcode.min.js"></script>

<script>
document.getElementById('loginBtn').onclick = async () => {
  // 1. Request a challenge from your sidecar
  const res = await fetch('/verus/login', { method: 'POST' });
  const { challengeId, deepLink } = await res.json();

  // 2. Show QR code
  document.getElementById('qrBox').style.display = 'block';
  await QRCode.toCanvas(document.getElementById('qr'), deepLink, { width: 250 });

  // 3. On mobile? Open the wallet directly
  if (/iPhone|Android/i.test(navigator.userAgent)) {
    window.location.href = deepLink;
  }

  // 4. Poll for result (every 3s, timeout 5min)
  const poll = setInterval(async () => {
    const r = await fetch(`/verus/result/${challengeId}`);
    const data = await r.json();
    if (data.status === 'verified') {
      clearInterval(poll);
      document.getElementById('qrBox').style.display = 'none';
      document.getElementById('welcome').style.display = 'block';
      document.getElementById('welcome').textContent =
        `Welcome, ${data.friendlyName}!`;
    }
  }, 3000);
};
</script>

Payment Button — add to any page

<!-- Accept payment for a product/service -->
<button onclick="pay()">Pay 5 VRSC</button>
<canvas id="payQr"></canvas>

<script>
async function pay() {
  const res = await fetch('/verus/pay-deeplink', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      address: 'REpxm9bCLMiHRNVPA9unPBWixie7uHFA5C',
      amount: 5
    })
  });
  const { deep_link } = await res.json();

  // Desktop: show QR. Mobile: open wallet.
  if (/iPhone|Android/i.test(navigator.userAgent)) {
    window.location.href = deep_link;
  } else {
    await QRCode.toCanvas(document.getElementById('payQr'), deep_link, { width: 250 });
  }
}
</script>

Demo: VerusID Login

Click the button to generate a login challenge. Scan the QR code with Verus Mobile or use the Verus browser extension.

Login Challenge Live
Scan with Verus Mobile
Waiting for signature...

Code

// Frontend: request a challenge
const res = await fetch('/verus/login', { method: 'POST' });
const { challengeId, deepLink } = await res.json();

// Show QR code with deepLink URI
showQR(deepLink);

// Poll for result
const poll = setInterval(async () => {
  const r = await fetch(`/verus/result/${challengeId}`);
  const data = await r.json();
  if (data.status === 'verified') {
    clearInterval(poll);
    console.log('Logged in as:', data.friendlyName);
  }
}, 3000);

Demo: Payment Deep Link

Generate a VerusPay QR code for any amount and address. The user scans it and their wallet opens with the payment pre-filled.

VerusPay Invoice Live
Scan to pay with Verus Mobile

Code

// Generate a payment deep link
const res = await fetch('/verus/pay-deeplink', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    address: 'REpxm9bCLMiHRNVPA9unPBWixie7uHFA5C',
    amount: 1.0
  })
});
const { deep_link } = await res.json();

// Show QR code
showQR(deep_link);

Demo: Identity Lookup

Look up any VerusID directly from the blockchain. No API key needed — this calls the public Verus RPC.

getidentity Live

Code

// Call the public Verus RPC (no auth needed)
const res = await fetch('https://api.verus.services', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '1.0',
    method: 'getidentity',
    params: ['Verus Coin Foundation@']
  })
});
const { result } = await res.json();

How VerusID Login Works

User clicks "Login with VerusID"

Your frontend calls POST /login on the sidecar. It creates a cryptographic challenge signed with your app's VerusID.

User scans the QR code

The QR contains a deep link that opens Verus Mobile. The wallet shows "App X wants to verify your identity" and the user approves.

Wallet signs and sends

The wallet signs a response with the user's VerusID private key and POSTs it to your callback URL.

Server verifies on-chain

The sidecar verifies the signature against the Verus blockchain. If valid, it stores the result with the user's i-address and friendly name.

Frontend gets the result

Your frontend polls GET /result/:challengeId and receives the verified VerusID. Create a session, JWT, or whatever your app needs.

GitHub · Verus.io · Discord