<>ts-stack
Get StartedArchitecturePackagesSpecsGuides
⌘K
Reference
Home
Get StartedOverviewInstallChoose your stackKey concepts
ArchitectureOverviewStack layersBEEF (BRC-62)BRC-100 Wallet InterfaceIdentity & AuthConformance pipeline
PackagesOverviewSDKWalletNetworkOverlaysMessagingMiddleware
@bsv/auth-express-middleware@bsv/payment-express-middleware@bsv/402-pay
Helpers
InfrastructureOverviewmessage-box-serveroverlay-serveruhrp-server-basicuhrp-server-cloud-bucketwabwallet-infrachaintracks-server
SpecsOverviewBRC-100 Wallet InterfaceOverlay HTTPMessage-box HTTPAuthsocket (WebSocket)BRC-31 Auth HandshakeBRC-29 Peer PaymentBRC-121 / HTTP 402ARC BroadcastMerkle ServiceStorage AdapterGASP SyncUHRPAir-Gap Optical (BRC-141)
ConformanceOverviewVector catalogTS runnerContributing vectors
GuidesOverviewIdentity, DIDs and credentialsIdentity migrationBuild a wallet-aware appRun an overlay nodePeer-to-peer messagingHTTP 402 payments
ReferenceOverviewBRC indexRepository health
AboutVersioningContributingDoc agentDocumentation sources
npmhttps://www.npmjs.com/package/@bsv/authv0.1.6betaAPI reference (TypeDoc) ↗
Loading…
Edit this page on GitHub
© 2026 BSV Blockchain. ts-stack is open-source.
GitHubContributingVersioning

@bsv/auth

This source candidate declares SDK peer ^2.1.6 || ^3.0.0. SDK3 remains a coordinated proposal; see the qualification and migration limits before adopting it.

@bsv/auth provides framework-neutral, expiry-bound, single-use wallet authentication proofs. It separates proof creation and verification from HTTP, Express, and database choices.

Install

Install the SDK peer dependency with the package:

bash
npm install @bsv/auth @bsv/sdk

Public API

  • AuthProofClient and createAuthProof create an action-bound proof with a wallet.
  • AuthProofServer and verifyAuthProof verify the signature, identity, action, expiry, and nonce.
  • checkAuthSigData, createAuthSigData, and serializeAuthSigData expose the lower-level proof data contract.
ts
import { AuthProofClient, AuthProofServer } from '@bsv/auth'

const options = { protocol: [2, 'example auth'] as [2, string] }
const client = new AuthProofClient(options)
const server = new AuthProofServer(options)

Client and server must use the same protocol. Production verification must inject an atomic consumeNonce implementation. A process-local map is suitable only for one process; replicated or restarting services need a shared store with uniqueness and expiry.

The verifier counterparty participates in key derivation at every valid security level. The level controls wallet consent (0 silent, 1 per app, 2 per counterparty), so choose it deliberately and prefer level 2 when each verifier needs separate user approval. Proof data, signature bytes, and wallet verdicts must be plain own data rather than inherited or accessor-backed authority, and are snapshotted before asynchronous wallet work. Structured request bodies reject non-finite numbers and negative zero because their JSON encodings are ambiguous.

The package publishes strict ESM and CommonJS entry points and supports Node.js 22 or newer. See the package README for a complete client/server example and store guidance.

License

Open BSV License Version 6. See the package license.