# @vaultfire/xmtp — audit candidate

## November 6 source candidate: qualification incomplete

The local `2.0.0-n05.5` candidate selects Node SDK `6.1.1`, Agent SDK
`2.3.1`, official native bindings `1.11.1`, ethers `6.17.0`, and
Vitest/coverage `5.1.0`. The development runtime is Node `22.23.3`.
The frozen install, build and 33 unit tests passed, and the selected lockfile
returned zero npm advisories. These results are not native declaration,
messaging-delivery, financial or production acceptance.

By default, `npm run test:installed` tests the actual owned package tarball
with the unmodified official upstream native graph. Its first no-ethers consumer
successfully loaded the real native binary in both package import orders,
then failed `skipLibCheck:false`: the upstream `1.11.1` declaration refers
to an undeclared `InboxId` in `fetchInboxUpdatesCount`. A normal official
installation therefore remains blocked for strict consumers, not covered
by an advisory exception or a suppressed type error.
The upstream package metadata is available at
[the exact 1.11.1 registry record](https://registry.npmjs.org/@xmtp/node-bindings/1.11.1).

To retain a fresh consumer and all command logs, set an absolute, nonexistent
`VAULTFIRE_INSTALLED_EVIDENCE_DIR` before running `npm run test:installed`.
The harness rejects reuse of that directory and records its first failure.
It does not create a wallet, send a message or authorize a financial action.

The same harness supports an explicit, separately pinned 1.11.1 type-only
derivative through `VAULTFIRE_NATIVE_BINDINGS_DERIVED_TAR`. See the
[current two-artifact contract](NATIVE_BINDINGS_COMPAT.md) for its reproducible
builder and exact installation commands. This is not an official registry fix.
Acceptance requires a PASS receipt for the exact owned tar and derivative,
both import orders, actual native loading, strict CTS/MTS and both optional
ethers profiles. The harness checks all installed native-package payloads and
modes against the manifest without changing them after installation.

On a constrained worker, `VAULTFIRE_PRUNE_PASSED_CONSUMER_NODE_MODULES=1`
removes only each newly created consumer's disposable dependency directory
after that complete profile passes. Its package, lock, runtime/type probes,
logs and report remain. Failures are never pruned by this option, and a
retained recipe or pruned successful install is not a full-artifact backup.

The explicitly reviewed `1.10.0` type-only derivation below is retained for
the historical `2.0.0-n05.4` profile. It is not a repair or acceptance of the
newer official `1.11.1` artifact, and it must not be described as an official
registry release. Its original runner remains available as
`npm run test:installed:historical-types` against that historical revision.

## Historical n05.4 implementation and recovery notes

Supported-SDK MLS messaging with explicit consent and legacy Vaultfire trust reads. This candidate is **not published** and is not production- or partner-funds-ready. See [audit limits](AUDIT_LIMITS.md).

## Pinned runtime

- Node >=22; qualification used Node22.23.3.
- `@xmtp/node-sdk` 6.0.0, `@xmtp/browser-sdk` 7.0.0, Agent SDK peer2.3.0.
- `ethers` >=6.16.0 for Ethereum identity signing.
- `package-lock.json` is the candidate dependency authority.
- The removed V2 `@xmtp/xmtp-js` transport is not a fallback.

Strict installed N05 consumers require the explicit
[two-artifact native declaration compatibility contract](NATIVE_BINDINGS_COMPAT.md),
not the owned tar alone. It retains the real SDK, external Agent peer, every
upstream platform binary and license, and changes one source-supported
declaration only. Its separate build/import/type evidence does not establish
network messaging, native platform execution everywhere, or financial authority.

XMTP uses its supported SDK identity and MLS APIs; wallet identity signatures do not authorize financial transactions. [XMTP client documentation](https://docs.xmtp.org/agents/build-agents/create-a-client)

## What is actually qualified

Evidence under `audit-evidence/oct20-2026/whole-repository/` distinguishes:

1. Host adversarial tests using injected SDK boundaries: consent denial, sender identity, replay, failure recovery, account privacy and fabricated-acknowledgement rejection.
2. A real dev-network DM and real MLS group message between two fresh ephemeral, unfunded controlled identities, through the canonical server wrapper/shared session core and authentic Node SDK6. Exact message IDs, sender inbox, conversation and plaintext hash were verified.
3. TypeScript build/typecheck and source parity; these are not remote delivery evidence.

The Browser SDK7 worker path is source/type reviewed, **not browser-runtime qualified by the Node factory test**. Production deployment, real consumer UI, durable multi-installation migration and live contract/runtime correspondence remain separate unverified lanes. No existing wallet, chain broadcast, financial signature, payment or partner message was used.

## Owner-controlled server API

```ts
import { XMTPClient } from '@vaultfire/xmtp';

// Obtain the key only through your own authorized secret-handling workflow.
// This example does not fund wallets or authorize spending.
const client = new XMTPClient({ privateKey: ownerSessionKey, env: 'dev' });
await client.ensureInitialised();
const published = await client.sendMessage(explicitlyChosenRecipient, 'Hello');
// success means SDK publication, not remote recipient receipt.
await client.close();
```

Initialization is explicit and errors are not converted into a connected local fallback. Disabled/invalid identities cannot send. The singleton refuses silent identity replacement. Closed sessions discard the retained owner key and subscriptions.

## Browser API

Import the browser entrypoint to avoid bundling the Node SDK:

```ts
import { XMTPBrowserClient } from '@vaultfire/xmtp/browser';
const client = new XMTPBrowserClient({ env: 'dev' });
await client.initializeWithPrivateKey(ownerSessionKey, ownerAddress);
const conversation = await client.createConversation(explicitRecipientAddress);
const published = await client.sendMessage(conversation.topic, 'Hello');
```

This key-based interface does **not** implement MetaMask/WalletConnect signing adapters. Never request a user's ordinary wallet private key. A production signer integration requires a separate owner-authorized adapter.

Unknown/denied incoming conversations do not reach message listeners. An explicit owner consent update is available through `setConversationConsent(topic, 'allowed' | 'denied' | 'unknown')`; previously denied DMs cannot silently be reallowed merely by calling send/create. [XMTP consent model](https://docs.xmtp.org/chat-apps/user-consent/support-user-consent)

`senderInboxId` is authenticated by the SDK. `senderAddress` is blank for remote senders because an associated EVM address is not proof that a particular wallet signed a particular MLS message. JSON author fields and unsigned `[VF:...]` footers are never identity authority.

Messages are memory-only (`dbPath:null`) and never stored in plaintext localStorage. Disconnect stops tracked streams and clears wrapper memory/listeners. Browser7 exposes client close; Node6 has no explicit client-close method, so native memory release remains runtime garbage collection after tracked streams end and references are dropped. This is not a promise of secure memory zeroization.

`recover()` explicitly resynchronizes allowed conversations and restarts streaming; it does not retry a send or re-sign financial data. Application replay suppression is bounded/in-memory; cross-installation durable replay/recovery is not implemented.

## Agent commands and spending boundary

The Agent SDK connector accepts only explicitly allowed, authenticated published MLS envelopes, with bounded per-agent duplicate suppression. Optional bond gating is additional to consent, never a substitute.

`/pay` and `x402:pay:` **never invoke wallet-signing/payment adapters**. They return an explicit disabled response. A local owner-authorized payment implementation is genuinely missing and is not represented as “supported.” Read-only payment/network explanations do not settle funds.

## Legacy trust data versus ERC-8004

Trust reads use configured legacy address-based registries and partnership bonds. Unknown chains and malformed addresses are rejected; membership is sender-specific, and a bond must actually name the queried participant.

Contract addresses are configured claims, not proof of a matching deployed runtime. The legacy registry interface is not canonical ERC-8004 ERC-721 conformance. Canonical adapter interoperability remains blocked pending protocol-owner source work and tests against the current specification. [ERC-8004 specification](https://eips.ethereum.org/EIPS/eip-8004)

## Build and review

```sh
node --version # Node >=22
npm ci --ignore-scripts
npm run build
```

The audit ran a pinned-dependency source typecheck/build with a selective dependency tree to respect disk limits; it did not complete a fresh isolated `npm ci` or the entire retained legacy Vitest suite. Those lanes remain explicit gaps rather than inherited passing status.

The repository website mirrors canonical `types.ts`, `xmtp-browser.ts` and `xmtp-connector.ts` through `scripts/sync_xmtp_surfaces.py`. Generated-byte parity proves source parity only; API health and route delivery must be independently observed in the actual deployment.
