Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.neus.network/llms.txt

Use this file to discover all available pages before exploring further.

Most apps should not start with window.ethereum. Send people to Hosted Verify on NEUS (passkey-first sign-in there, no wallet extension in your UI), then save qHash on your server keyed to your user. Use in-app wallet signing only when you deliberately need it.

1. Install

npm install @neus/sdk

2. Create a proof (default: Hosted Verify)

Redirect the browser to NEUS. After success, NEUS sends the user back to returnUrl with qHash in the query string (your callback route should read it and persist it).
import { getHostedCheckoutUrl } from '@neus/sdk';

const url = getHostedCheckoutUrl({
  verifiers: ['ownership-basic'],
  returnUrl: 'https://myapp.com/neus/callback',
});

window.location.assign(url);
Save qHash in your database next to your own userId. It is the portable trust receipt reference. Hosted Verify covers mode=popup, origin, and postMessage if you prefer a popup.

React: gate in place

If you already use React, VerifyGate opens the hosted flow when needed and keeps your page free of wallet UI:
import { VerifyGate } from '@neus/sdk/widgets';

<VerifyGate
  appId="your-app-id"
  requiredVerifiers={['ownership-basic']}
>
  <ProtectedContent />
</VerifyGate>

3. Poll (optional)

If you issued a proof from your own backend (API + npk_*) and need to wait on async work, poll by qHash. Hosted redirect users usually already have qHash on the return URL.
import { NeusClient } from '@neus/sdk';

const client = new NeusClient({ appId: 'your-app-id' });

const status = await client.pollProofStatus(qHash, {
  interval: 3000,
  timeout: 60000,
});

4. Check from your server

Use gateCheck in trusted server code (Node, serverless route, backend worker), not in a public browser bundle, for security-sensitive allow/deny.
const client = new NeusClient({ appId: 'your-app-id' });

const result = await client.gateCheck({
  address: '0x...',
  verifierIds: ['ownership-basic'],
});

5. Advanced: wallet inside your app

Only if you intentionally want the user to sign inside your domain with a browser wallet:
const client = new NeusClient({ appId: 'your-app-id' });

const proof = await client.verify({
  verifier: 'ownership-basic',
  content: 'My content or claim',
  wallet: window.ethereum,
});

const qHash = proof.qHash;
client.verify() defaults private. See SDK authentication and Signing format. Next: Integration