# @glyphteck/veyl

Use a Veyl account from Node.js or the shell. The package provides:

- account, profile, and peer management
- end-to-end encrypted notes, direct chats, groups, files, reactions, and payment requests
- a self-custodial Spark wallet for peer payments, Lightning, and Bitcoin withdrawals
- a JavaScript API, JSON CLI, and live events for agents and automations

Requires Node.js 22 or newer.

## install

```bash
bun add @glyphteck/veyl
# or: npm install @glyphteck/veyl
```

## quick start

```js
import { open } from '@glyphteck/veyl';

const veyl = await open({ profile: 'runner', network: 'REGTEST' });
const accountKey = await veyl.account.create({ username: 'runner' });
const vaultKey = await veyl.vault.create();

await veyl.chat.send('@alice', 'hello');
console.log(await veyl.wallet.balance());
await veyl.close();
```

`accountKey` authenticates the account. `vaultKey` unlocks its chat and wallet. By default, both are saved in `~/.veyl/profiles/runner.json` with owner-only permissions so later runs can call `account.login()` and `vault.unlock()` without passing them again.

To store the keys in your own secret manager, pass `saveKey: false` to both creation calls and provide them later through `open({ accountKey, vaultKey })`, `VEYL_ACCOUNT_KEY`, and `VEYL_VAULT_KEY`. Never log or commit either key.

Use `REGTEST` for development and disposable accounts. `MAINNET` uses real funds. Creating an account accepts Veyl's [Terms](https://veyl.glyphteck.com/terms#terms), which include the community rules.

## CLI

The CLI prints JSON, which makes it suitable for shell scripts and agents.

```bash
bunx veyl --network REGTEST account create @runner
bunx veyl vault create
bunx veyl chat send @alice "hello"
bunx veyl wallet balance
```

Run `bunx veyl help` for the full command list. Long-running agents should keep one JavaScript client or persistent CLI session open instead of starting a new wallet and chat session for every action.

## documentation

- [JavaScript API](docs/api.md)
- [CLI reference](docs/cli.md)
- [agent operation](docs/agents.md)
- [single-account Codex agent](examples/codex-agent/readme.md)
- [MCP documentation discovery](docs/discovery.md)

## license

This package is proprietary. The unmodified SDK may be used with Veyl; see the [license](LICENSE) for terms.
