open-index/open-npm huggingface dataset:
npm package: @snap-bridge/sdk
Description: TypeScript client library for SNAP Agents connecting to a [SNAP Bridge](https://github.com/user/snap-bridge) server. Handles WebSocket transport, BIP-340 message signing, identity binding, certificate lifecycle, and message routing.
Latest version: 0.1.0

# @snap-bridge/sdk

TypeScript client library for SNAP Agents connecting to a [SNAP Bridge](https://github.com/user/snap-bridge) server. Handles WebSocket transport, BIP-340 message signing, identity binding, certificate lifecycle, and message routing.

## Install

```bash
npm install @snap-bridge/sdk ws
```

## Quick Start

```typescript
import { createBridgeClient } from '@snap-bridge/sdk';

const client = createBridgeClient({
  privateKey: process.env.AGENT_PRIVATE_KEY!,
});

// Register message handler before pairing
client.onRequest('message/send', async (msg) => {
  const text = (msg.payload.message as any)?.parts?.[0]?.text ?? '';
  const reply = await myAgent.process(text);

  client.sendResponse(msg.id, {
    id: msg.id,
    status: { state: 'completed', timestamp: new Date().toISOString() },
    artifacts: [{ parts: [{ text: reply }] }],
  });
});

await client.connect(process.env.BRIDGE_URL!);
const binding = await client.pair(process.env.PAIRING_CODE!);
console.log(`Bound as ${binding.identity}`);
```

## Documentation

Full specification with API reference and integration cookbook:

**[SNAP Bridge SDK Specification](../../docs/spec/snap-sdk-spec.md)**

## License

MIT