@solidus-network/auth
v0.3.0
Published
DID-based authentication for the Solidus Network protocol — Ed25519 challenge / W3C Verifiable Presentation verification primitives.
Maintainers
Readme
@solidus-network/auth
DID-based authentication primitives for the Solidus Network protocol.
Ed25519 challenge / signature / verification, designed to drop into any Node.js or edge backend that needs to authenticate a holder of a DID without operating its own user database.
Install
npm install @solidus-network/auth
# or
pnpm add @solidus-network/authQuick start
import { generateChallenge, verifyChallenge } from '@solidus-network/auth'
// Server: issue a challenge
const challenge = generateChallenge({
did: 'did:solidus:testnet:abc123',
domain: 'app.example.com',
ttlMs: 5 * 60_000,
})
// Client signs `challenge.nonce` with the DID's signing key, returns the signature
// Server: verify
const result = await verifyChallenge({
challenge,
signature,
publicKey,
})
if (result.ok) {
// authenticated
}Features
- Ed25519 signature verification via @noble/ed25519
- BLAKE3 hashing for challenge digests via @noble/hashes
- Time-bounded challenges with TTL enforcement
- Domain-bound challenges (prevents replay across origins)
- Zero runtime dependencies on a database or framework
License
Apache-2.0 — see LICENSE.
