DogeJS / All tools / Sign in with Doge

Sign in with Doge

One button. The visitor approves in their wallet and is signed in. No passwords, and no coins move.

There is no hosted builder for Sign in with Doge. You add it to your own page: the docs show the two lines under "Add it to your site".

dogejs.com/signin/
The Sign in with Doge window over a shop page, listing MyDoge, the DogeJS Wallet and Use another wallet.

What it does

dogejs.com/signin/
Six styles of the Sign in with Doge button: dark, yellow, outline, compact and a large one.

One button on your page

Place the button where visitors sign in. It comes in six looks, so it fits a light page, a dark page or a tight toolbar.

  • A plain HTML tag, no framework needed
  • Light, yellow, outline and compact styles
  • Tells your page when the visitor has signed
The DogeJS Wallet approval sheet: sign-in request from the website, the address shared, the network and a Sign in button.

The visitor approves in their wallet

The wallet shows which site is asking and the text to be signed. Approving shares an address and moves no coins.

  • Shows the site, the address and the network
  • Plain, readable text instead of a hex blob
  • No keys or recovery words are shared
dogejs.com/signin/
The success state: a green check, Signed in, the address.

Signed in, and your server checks it

The page receives the address and a signature. Your server verifies them before it trusts anyone and starts its own session.

  • A one-time challenge with an expiry stops replays
  • Checking in the browser is only for display: verify on your server
  • Works with MyDoge, the DogeJS Wallet or any wallet that signs messages

Sign in with Doge

Open source, MIT licensed, on GitHub.

For developers

Documentation

The challenge format, the flow, and how to verify a sign-in on your server.

The challenge text

The wallet signs a short, readable text (modelled on EIP-4361, adapted for Dogecoin). This one was produced by createSignInMessage in the Node example below:

Challenge
shop.example wants you to sign in with your Dogecoin address:
ncKhVJVYFCoFfFpMp8yTPjzwt3yykFcDcC

Sign in to Example Shop.

URI: https://shop.example/login
Version: 1
Network: testnet
Nonce: e9106b1bf4f051cb357b72bb4330ccc4
Issued At: 2026-11-29T01:03:08.953Z
Expiration Time: 2026-11-29T01:08:08.953Z
PartRule
Line 1: domainLowercase host, with port if any, exactly as location.host; then the fixed words "wants you to sign in with your Dogecoin address:". The words say "Dogecoin" on purpose, so a message from another chain cannot be passed off as this one.
Line 2: addressBase58Check P2PKH address, checked against the stated network.
Statement (optional)One line, 1 to 1024 characters, no leading or trailing space, no control or invisible characters. Absent: two empty lines in a row.
URIWhere the sign-in happens: an absolute URI of printable ASCII, up to 2048 characters.
VersionAlways 1.
Networkmainnet or testnet (testnet covers regtest).
Nonce16 to 128 letters or digits. The one your server issued.
Issued AtUTC time, YYYY-MM-DDThh:mm:ss[.mmm]Z.
Expiration Time (optional)Must be after Issued At. The element sets it from expires-in (default 600 seconds).
Not Before, Request ID, Resources (optional)In that order; up to 32 resource URIs.

Fixed order, one space after each colon, at most 8192 characters, no carriage returns. The parser accepts exactly what createSignInMessage produces and rejects everything else, so a statement such as URI: x cannot be mistaken for the URI line.

The flow

1Your serverissues a nonceand remembers it2The pagebuilds the text,shows the button3The walletshows the text,the person approves4Your serververifies, uses thenonce once, starts a session

No coins move, no fee is paid and nothing goes on chain. A signature proves that someone holding the key signed this exact text at that time. It does not prove who they are or that they own any coins.

Add it to your page

Copy signin.js (112,103 bytes on this site) to your own host. The page asks your server for a nonce, gives it to the element, and posts the proof to your server when the wallet has signed:

HTML
<script src="signin.js?v=202611291136" defer></script>

<doge-signin id="signin" mode="button" network="mainnet"
             statement="Sign in to Example Shop." expires-in="300"></doge-signin>

<script>
  const el = document.getElementById('signin');

  // 1. Ask YOUR server for a fresh one-use nonce, and give it to the element.
  async function newChallenge() {
    const { nonce } = await (await fetch('/challenge', { method: 'POST' })).json();
    el.setAttribute('nonce', nonce);
  }
  newChallenge();

  // 2. The wallet signed. Send the proof to your server; it decides whether to log the person in.
  el.addEventListener('doge-signin:verified', async (e) => {
    const { message, signature } = e.detail;
    const res = await fetch('/login', {
      method: 'POST',
      headers: { 'content-type': 'application/json' },
      body: JSON.stringify({ message, signature }),
    });
    console.log('server says', res.status, JSON.stringify(await res.json()));
    if (!res.ok) newChallenge();            // a nonce is used once, so ask for a new one
  });
</script>

Tested in Chrome against the server below, with MyDoge simulated by a stand-in extension: the console showed server says 200 {"address":"DPcyZZYN9Z5fyRBLkEqbqwFkfdf9oQ9nfc"}.

Verify on your server

Never trust the browser's "verified". The server rebuilds what it expects and checks the proof against that, not against what the message says about itself:

JavaScript (server.mjs)
// Node 20+, no framework. POST /challenge issues a nonce; POST /login verifies the signed text and starts a session.
import { createServer } from 'node:http';
import { randomBytes } from 'node:crypto';
import { generateNonce, parseSignInMessage, verifySignIn } from '@dogejs/signin/verify';

const DOMAIN = 'shop.example';                 // exactly what location.host shows in the browser
const URI_PREFIX = 'https://shop.example/';
const nonces = new Map();                      // nonce -> expiry (ms). Use Redis or a database if you run several servers.
const sessions = new Map();                    // session id -> address

const json = (res, status, body, headers = {}) => {
  res.writeHead(status, { 'content-type': 'application/json', ...headers });
  res.end(JSON.stringify(body));
};
const readJson = async (req) => { let s = ''; for await (const c of req) s += c; return JSON.parse(s || '{}'); };

createServer(async (req, res) => {
  if (req.method === 'POST' && req.url === '/challenge') {
    const nonce = generateNonce();
    nonces.set(nonce, Date.now() + 5 * 60_000);
    return json(res, 200, { nonce });
  }
  if (req.method === 'POST' && req.url === '/login') {
    const { message, signature } = await readJson(req);
    let nonce;
    try { nonce = parseSignInMessage(message).nonce; } catch { return json(res, 400, { error: 'malformed' }); }

    const expiry = nonces.get(nonce);
    nonces.delete(nonce);                      // single use, whatever happens next
    if (!expiry || expiry < Date.now()) return json(res, 401, { error: 'unknown_or_used_nonce' });

    const r = verifySignIn({ message, signature, expected: { domain: DOMAIN, nonce, network: 'mainnet' } });
    if (!r.ok) return json(res, 401, { error: r.reason });
    if (!r.fields.uri.startsWith(URI_PREFIX)) return json(res, 401, { error: 'uri_mismatch' });

    const sid = randomBytes(24).toString('hex');
    sessions.set(sid, r.address);              // r.address is the proven address
    return json(res, 200, { address: r.address },
      { 'set-cookie': `sid=${sid}; HttpOnly; Secure; SameSite=Lax; Path=/; Max-Age=86400` });
  }
  json(res, 404, { error: 'not_found' });
}).listen(3000);

Run: issue, sign, verify and replay

JavaScript
// The whole Sign in with Doge server flow in one file: challenge, wallet signature, verification.
import { generatePrivateKey, getPublicKey, encodeWif, p2pkhAddress, signMessage, testnet } from '@dogejs/core';
import { createSignInMessage, generateNonce, verifySignIn } from '@dogejs/signin/verify';

// ---- Server: a nonce store. One use only; entries expire after 10 minutes.
const nonces = new Map();
const issueNonce = () => { const n = generateNonce(); nonces.set(n, Date.now() + 10 * 60_000); return n; };
const consumeNonce = (n) => { const exp = nonces.get(n); nonces.delete(n); return exp !== undefined && exp > Date.now(); };

// ---- Wallet (stands in for the visitor's wallet): signs whatever text it is shown.
const key = generatePrivateKey();
const address = p2pkhAddress(getPublicKey(key), testnet);
const wallet = (text) => signMessage(text, encodeWif(key, { network: testnet }));

// 1. GET /challenge: the server picks the nonce and the page builds the text (the <doge-signin> element does this for you).
const nonce = issueNonce();
const message = createSignInMessage({
  domain: 'shop.example', address, uri: 'https://shop.example/login', network: 'testnet',
  statement: 'Sign in to Example Shop.', nonce, issuedAt: new Date(), expirationTime: new Date(Date.now() + 5 * 60_000),
});
console.log(message);
console.log('---');

// 2. The wallet shows the text, the person approves, the wallet signs.
const signature = wallet(message);

// 3. POST /login: verify against what YOU expect, never against what the message says about itself.
function login({ message, signature }, expectedNonce) {
  const r = verifySignIn({ message, signature, expected: { domain: 'shop.example', nonce: expectedNonce, network: 'testnet', uri: 'https://shop.example/login' } });
  if (!r.ok) return { ok: false, why: r.reason };
  if (!consumeNonce(expectedNonce)) return { ok: false, why: 'nonce_reused' };   // YOUR bookkeeping: one use only
  return { ok: true, address: r.address };
}
const first = login({ message, signature }, nonce);
console.log('first attempt :', first.ok, first.address === address ? '(address proven)' : '');
console.log('replayed      :', JSON.stringify(login({ message, signature }, nonce)));
Output
shop.example wants you to sign in with your Dogecoin address:
naLpXpKgcqZXHiVzXLr8Khwr4A73MtYqXn

Sign in to Example Shop.

URI: https://shop.example/login
Version: 1
Network: testnet
Nonce: 4c6c248e35f4acf2a529f06d9ed9c48e
Issued At: 2026-11-29T01:06:30.012Z
Expiration Time: 2026-11-29T01:11:30.012Z
---
first attempt : true (address proven)
replayed      : {"ok":false,"why":"nonce_reused"}

The rules, and what each failure looks like

Run: every check failing in turn

JavaScript
import { generatePrivateKey, getPublicKey, encodeWif, p2pkhAddress, signMessage, testnet } from '@dogejs/core';
import { createSignInMessage, generateNonce, verifySignIn, parseSignInMessage } from '@dogejs/signin/verify';

const key = generatePrivateKey();
const address = p2pkhAddress(getPublicKey(key), testnet);
const sign = (m) => signMessage(m, encodeWif(key, { network: testnet }));
const base = { domain: 'shop.example', address, uri: 'https://shop.example/login', network: 'testnet', nonce: generateNonce(), statement: 'Sign in to Example Shop.' };
const expected = { domain: 'shop.example', nonce: base.nonce, network: 'testnet' };
const now = new Date('2026-11-28T12:00:00Z');
const make = (extra = {}, over = {}) => { const m = createSignInMessage({ ...base, issuedAt: now, expirationTime: new Date(now.getTime() + 600_000), ...extra }); return { message: m, signature: sign(m), ...over }; };
const check = (label, input, exp = expected, at = new Date(now.getTime() + 60_000)) => {
  const r = verifySignIn({ ...input, expected: exp, now: at });
  console.log(label.padEnd(34), r.ok ? 'ok' : `${r.reason}`);
};

check('good, one minute after issue', make());
check('three minutes past expiry', make(), expected, new Date(now.getTime() + 600_000 + 180_000));
check('just inside the 60 s skew', make(), expected, new Date(now.getTime() + 600_000 + 30_000));
check('signed for another domain', make({ domain: 'evil.example' }));
check('another nonce than the one issued', make(), { ...expected, nonce: generateNonce() });
check('mainnet expected, testnet message', make(), { ...expected, network: 'mainnet' });
check('uri differs', make(), { ...expected, uri: 'https://shop.example/admin' });
check('one character of the text changed', (() => { const g = make(); return { ...g, message: g.message.replace('Example Shop.', 'Example Shop!') }; })());
check('signature from another key', (() => { const g = make(); const other = generatePrivateKey(); return { ...g, signature: signMessage(g.message, encodeWif(other, { network: testnet })) }; })());
check('not a signature', make({}, { signature: 'AAAA' }));
check('issued in the future', make({ issuedAt: new Date(now.getTime() + 3_600_000), expirationTime: new Date(now.getTime() + 4_200_000) }));
check('not even a message', { message: 'hello', signature: 'x' });
console.log('parse a message back:', Object.keys(parseSignInMessage(make().message)).join(', '));
Output
good, one minute after issue       ok
three minutes past expiry          expired
just inside the 60 s skew          ok
signed for another domain          domain_mismatch
another nonce than the one issued  nonce_mismatch
mainnet expected, testnet message  wrong_network
uri differs                        uri_mismatch
one character of the text changed  signature_mismatch
signature from another key         signature_mismatch
not a signature                    malformed_signature
issued in the future               not_yet_valid
not even a message                 malformed_message
parse a message back: domain, address, uri, version, network, nonce, issuedAt, statement, expirationTime
RuleWhat the server must do
DomainPass your own domain in expected.domain. Never read it from the message. A signature made for another site fails with domain_mismatch.
NonceIssue it yourself, store it, accept it once, expire it. verifySignIn checks that it matches; whether it was used already is your bookkeeping (replay protection).
ExpiryThe message carries Expiration Time; a 60 second clock skew is allowed (clockSkewSeconds). Keep it short.
Network and URIPass expected.network, and expected.uri when one domain hosts several apps.
SignatureDogecoin Core signmessage format, 65 bytes, base64. Checked last because it is the costly step.

All reasons returned

reasonMeaning
invalid_argumentsUnusable input (no expected domain or nonce, non-string message). Fails closed.
malformed_messageNot exactly the grammar; detail says which line.
unsupported_address_typeA P2SH address. Script addresses cannot sign messages.
domain_mismatch, nonce_mismatch, uri_mismatch, wrong_network, address_mismatchThe message differs from what you expected.
expired, not_yet_validTime checks against now with the skew.
malformed_signature, signature_mismatchNot a 65-byte base64 signature, or not made by this address over this exact text.

verifySignIn never throws.

Attributes and events

AttributeDefaultMeaning
domainlocation.hostDomain in the challenge. Set it on file:// pages.
statementnoneOne line shown in the challenge.
networkmainnetmainnet or testnet.
noncegenerated16 to 128 letters or digits. Supply one from your server when you verify there.
uricurrent URL without #fragmentURI in the challenge.
expires-in600Seconds until the challenge expires. 0: no expiry (the DogeJS Wallet refuses those).
wallet-urlhttps://dogejs.com/wallet/app/Where the DogeJS Wallet pop-up opens.
walletsallComma list of mydoge, dogejs, manual.
modecardbutton shows a button that opens a dialog.
button-style, button-size, button-label, button-blocksolid, mdsolid/outline/yellow; sm/md/lg; text; full width.
size, themeregular, autocompact; dark or light.
Eventdetail
doge-signin:verified{ address, network, fields, message, signature }. Send message and signature to your server.
doge-signin:failed{ reason, detail }
doge-signin:open, doge-signin:closeButton mode.

Methods and properties: newChallenge(), open(), close(), challengeNonce, walletAdapter, signWithWallet(). Custom properties: --doge-signin-bg, -ink, -accent, -on-accent, -radius, -border, -button, -muted, -ok, -bad, -warn.

Wallets supported

WalletHow it signs
MyDoge (browser extension)connect() then requestSignedMessage. One click.
DogeJS WalletPop-up window and postMessage; the wallet shows the site and the text and signs after approval. It needs an https page (or localhost) and a challenge with an expiry of at most one day.
Any other walletManual path: copy the challenge, sign it with "sign message" (Dogecoin Core: dogecoin-cli signmessage "D..." "<challenge>"), paste the signature.

Only P2PKH addresses (D… on mainnet) can sign in. Multisig and other script (P2SH) wallets cannot, because a plain message signature has no script to commit to.

Session handling

  • After ok, create your own session (random id, HttpOnly; Secure; SameSite=Lax cookie) as the example does. The signature itself is not a session.
  • Consume the nonce before anything else, even on failure.
  • Use a shared store (Redis or a database) for nonces if you run more than one server.
  • A signature proves control of a key, not ownership of coins. For token-gating, check the chain yourself.
  • Verification in the browser alone is personalisation, not access control: anything the page can check, the visitor can bypass.

Self-hosting

Source: github.com/DogeJS-Dev/sign-in (package @dogejs/signin).

Shell
git clone https://github.com/DogeJS-Dev/sign-in
cd sign-in
npm install
npm run build   # dist/signin.js for a script tag; dist/ also has the ESM entries
npm test

Copy dist/signin.js to your host. The server entry @dogejs/signin/verify needs no DOM and runs in Node 20+ and edge runtimes. The element makes no request of its own to anyone except a wallet window you open.

FAQ

Does the person pay anything?

No. Nothing goes on chain.

Can I skip the server?

For showing "signed in as D..." on a static page, yes. For anything that needs protecting, no.

Why did my verification return domain_mismatch?

The domain in the challenge must equal what you pass in expected.domain, which should match location.host in the browser, port included.

Can a multisig wallet sign in?

No. Only single-key P2PKH addresses can sign messages.

How long is a challenge valid?

600 seconds by default (expires-in), plus 60 seconds of clock skew on the server.