ORIEN

For developers

Sign in with Orien Wallet

A person’s Orien wallet is their login: no email, no password, and no ORN moves. Your website checks the proof itself, offline, with Orien’s quantum-safe signatures. Free, with nothing to register.

How it works

It works the way Phantom and MetaMask sign-ins do. People click your sign-in button and approve in the Orien Wallet browser extension, for Chrome, Edge, Brave, Firefox and Safari. Your website receives their wallet address and a proof that the wallet signed in to your website, just now.

Your server checks the proof by itself, with no network and no server to ask, orien.network included. Nothing a website receives can move ORN.

People need Orien Wallet running on their computer. Phones aren’t supported yet.

1. Add the script to your page

<script src="https://orien.network/orien-sign-in.js"></script>

It has no dependencies and is MIT licensed. The same file checks proofs on your server.

2. Make a nonce on your server

A nonce is a one-time value: any string up to 200 characters. Your server makes one for each sign-in and remembers it. OrienSignIn.newNonce() makes a good one.

3. Add the button

The same button as on orien.network, so people recognise it. Copy it as it is: it needs no images or fonts.

<button type="button" class="orien-signin">
  <svg viewBox="0 0 512 512" width="28" height="28" aria-hidden="true"><g fill="currentColor"><rect x="239" y="74" width="36" height="66" rx="18"/><rect x="239" y="74" width="36" height="66" rx="18" transform="rotate(-44 256 298)"/><rect x="239" y="74" width="36" height="66" rx="18" transform="rotate(44 256 298)"/><path d="M138 298A118 118 0 0 1 374 298Z"/><rect x="76" y="338" width="360" height="40" rx="20"/><rect x="156" y="406" width="200" height="36" rx="18"/></g></svg>
  Sign in with Orien Wallet
</button>

<style>
  .orien-signin {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    height: 44px; padding: 0 24px; border: 0; border-radius: 12px; cursor: pointer;
    background: linear-gradient(115deg, #f4b6d4 0%, #b8c7ff 20%, #d3b6ff 38%, #a6ead6 56%, #f9dda4 74%, #f4b6d4 100%);
    background-size: 300% 300%; animation: orien-pearl 12s ease-in-out infinite;
    color: #0b0b0f; font: 700 14px/1 system-ui, -apple-system, sans-serif;
  }
  .orien-signin:hover { filter: brightness(1.05); }
  .orien-signin:disabled { opacity: 0.6; cursor: default; }
  @keyframes orien-pearl { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
  @media (prefers-reduced-motion: reduce) { .orien-signin { animation: none; } }
</style>

4. Sign in when it’s clicked

OrienSignIn.signIn({ nonce }) asks the extension, and resolves once the person approves. Send the address and proof to your server.

document.querySelector(".orien-signin").onclick = async () => {
  const nonce = await fetch("/sign-in/nonce").then((r) => r.text())   // from your server
  try {
    const { address, proof } = await OrienSignIn.signIn({ nonce })
    await fetch("/sign-in", {
      method: "POST",
      headers: { "content-type": "application/json" },
      body: JSON.stringify({ address, proof }),
    })
  } catch (error) {
    alert(error.message)   // plain sentences, fine to show people
  }
}

5. Check the proof on your server

Download orien-sign-in.js next to your server’s code. It runs in Node 18 and later, Deno and Bun.

const { verifySignIn, newNonce } = require("./orien-sign-in.js")

// GET /sign-in/nonce: a one-time value, remembered until it is used.
const nonce = newNonce()

// POST /sign-in: throws with a plain reason if the proof isn't good.
const address = verifySignIn(proof, { origin: "https://yoursite.com", nonce })
// Accept each nonce once, forget it, then start the session for address.

verifySignIn returns the wallet’s address, or throws with a plain reason. Accept each nonce once, then start the session.

6. Show who signed in (optional)

People who verified their wallet on orien.network have a public profile. OrienSignIn.profile(address) returns it, or null for a wallet that isn’t verified. Links hold only what the person chose to show.

const who = await OrienSignIn.profile(address)
// null, or:
{
  name: "Satoshi",
  bio: "…",
  wallet: "Savings",
  picture: "https://orien.network/api/market/images/….jpg",
  banner: "https://orien.network/api/market/images/….jpg",
  profile: "https://orien.network/u/Satoshi/",
  links: [{ kind: "x", handle: "satoshi", url: "https://x.com/satoshi" }]
}

Details

Proofs
Good for 5 minutes, and only for the exact origin the browser reports: scheme, host and port, such as https://yoursite.com.
The raw API
The extension adds window.orien, with window.orien.signIn({ nonce }), and fires orien#initialized on the page when it does.
Errors
Plain sentences, fine to show to people.
Without the extension
signIn() throws “Orien Wallet isn’t set up for this website yet…”. Send people to orien.network for Orien Wallet and its extension.

See it working

The demo is a whole website on one page: it makes the nonce, signs in, checks the proof and shows the profile. View its source for a complete example.