
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@bsv/authsocket-client
Advanced tools
This repository provides a drop-in client-side solution for Socket.IO that signs all outbound messages and verifies inbound messages using BRC-103.
authsocket) or any custom server that can verify BRC-103 messages.socket.io-client usage.npm install
Wallet (e.g., from @bsv/sdk or your own).Below is a minimal client code that wraps socket.io-client:
import { AuthSocketClient } from '@bsv/authsocket-client'
import { ProtoWallet } from '@bsv/sdk' // your BRC-103-compatible wallet
// Create or load your local BRC-103 wallet
const clientWallet = new ProtoWallet('client-private-key-hex')
// Wrap the normal Socket.IO client with AuthSocketClient
const socket = AuthSocketClient('http://localhost:3000', {
wallet: clientWallet
})
// Standard Socket.IO usage
socket.on('connect', () => {
console.log('Connected to server. Socket ID:', socket.id)
// Emit a sample message
socket.emit('chatMessage', {
text: 'Hello from client!'
})
})
socket.on('chatMessage', (msg) => {
console.log('Server says:', msg)
})
socket.on('disconnect', () => {
console.log('Disconnected from server')
})
AuthSocketClient(serverUrl, options) to create a BRC-103-secured socket client..on(...), .emit(...) as normal.AuthSocketClient creates an internal BRC-103 Peer that handles:
'authMessage' channel is used for the underlying BRC-103 handshake. You only interact with standard Socket.IO event names (like 'chatMessage'), as AuthSocketClient automatically re-dispatches them.Transport interface on the client side.socket.io-client for raw message passing via the 'authMessage' channel.Peer calls this transport to send and receive raw BRC-103 frames.io(url, managerOptions) from socket.io-client.SocketClientTransport.Peer with your wallet..on(eventName, callback) and .emit(eventName, data) methods.Note: If you want to see a full end-to-end example, combine the server code from the
authsocketREADME with the client code from theauthsocket-clientREADME, then run both. You should see messages securely exchanged and logs showing mutual authentication in action.
See LICENSE.txt.
FAQs
Mutually Authenticated Web Sockets Client
We found that @bsv/authsocket-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.