This source candidate declares SDK peer ^2.1.6 || ^3.0.0 || ^4.0.1. SDK3 remains
a coordinated proposal; see the qualification and migration limits
before adopting it.
TypeScript library for BSV Paymail (BRC-28 capability discovery and routing). Provides a client and an Express router with built-in support for PKI, P2P destinations, transaction receipt, public profiles and BRC-235 profile lookup.
The 2.5.0 source candidate adds BRC-235 public profile lookup and reverse lookup. Earlier candidates fixed the CommonJS build of the P2P signature and PaymailClient key helpers. No API migration is required.
npm install @bsv/paymailimport { PaymailClient, PublicProfileCapability } from '@bsv/paymail'
const client = new PaymailClient()
const publicProfile = await client.getPublicProfile('satoshi@myDomain.com')
console.log(publicProfile.name, publicProfile.avatar)
const profileEndpoint = await client.ensureCapabilityFor(
'myDomain.com',
PublicProfileCapability.getCode()
)
console.log(profileEndpoint)
const pkiResult = await client.getPki('satoshi@myDomain.com')
console.log(pkiResult.pubkey) // user's identity key/.well-known/bsvalias and the configured capability routesdomainLogicHandler callbackimport express from 'express'
import { PaymailRouter, PublicKeyInfrastructureRoute, PublicProfileRoute } from '@bsv/paymail'
const app = express()
const baseUrl = 'https://myDomain.com'
const publicProfileRoute = new PublicProfileRoute({
domainLogicHandler: async params => {
const { name, domain } = PublicProfileRoute.getNameAndDomain(params)
const user = await fetchUser(name, domain)
return {
name: user.getAlias(),
domain,
avatar: user.getAvatarUrl()
}
}
})
const pkiRoute = new PublicKeyInfrastructureRoute({
domainLogicHandler: async params => {
const { name, domain } = PublicKeyInfrastructureRoute.getNameAndDomain(params)
const user = await fetchUser(name, domain)
return {
bsvalias: '1.0',
handle: `${name}@${domain}`,
pubkey: user.getIdentityKey()
}
}
})
const routes = [publicProfileRoute, pkiRoute]
const paymailRouter = new PaymailRouter({ baseUrl, routes })
app.use(paymailRouter.getRouter())
app.listen(3000, () => {
console.log(`Paymail server running on ${baseUrl}:3000`)
})import { PaymailClient, PublicProfileCapability } from '@bsv/paymail'
const client = new PaymailClient()
// Get public profile
const profile = await client.getPublicProfile('alice@example.com')
console.log(profile.name, profile.avatar)
// Discover all capabilities
const profileEndpoint = await client.ensureCapabilityFor(
'example.com',
PublicProfileCapability.getCode()
)
// Get user's public key
const pki = await client.getPki('alice@example.com')
// Get payment destination
const p2pDest = await client.getP2pPaymentDestination('alice@example.com', 10000)/.well-known/bsvalias lists each capability's URL template; the routes themselves live wherever the host puts themdomainLogicHandler callbackname@domain, validated before any request0ace65da5987 and 43dcf83ddc5f routes, client methods with full certificate verificationReceiveBeefTransactionRoute and sendBeefTransactionP2PcreateProfileCertificate signs with a wallet's identity keydomainLogicHandler callbacks are async; implement accordinglyname@domain format; invalid paymail raises error_bsvalias._tcp SRV record (DNSSEC required when it names another host), then the well-known document over HTTPSlookupProfiles()[0]The SDK4 peer alternative now requires @bsv/sdk ^4.0.1 for the numeric wallet
result and legacy wire hotfix. Existing SDK2/3 alternatives and lower bounds
remain unchanged. No wire or data migration is required.