QVAC Logo

startQVACProvider( )

Starts a provider service that offers QVAC capabilities to remote peers.

function startQVACProvider(params?: ProvideParams): Promise<object>;

Starts a provider service that exposes this SDK instance to remote peers over the DHT. Consumers connect to the provider directly via its public key using dht.connect(publicKey) — no topic or discovery step is required.

The provider's keypair (and therefore its public key) can be controlled via the QVAC_HYPERSWARM_SEED environment variable.

Parameters

NameTypeRequired?Description
params.firewallFirewallConfigOptional firewall configuration to allow/deny specific consumer public keys

FirewallConfig

FieldTypeRequired?DefaultDescription
mode"allow" | "deny""allow"Firewall mode
publicKeysstring[][]Public keys to allow or deny

Returns

Promise<object> — The provide response containing success, publicKey, and optional error. Share publicKey with consumers so they can connect via delegate.providerPublicKey.

Throws

ErrorWhen
INVALID_RESPONSE_TYPEResponse type does not match expected "provide"
PROVIDER_START_FAILEDThe server reports provider start failure

Example

const response = await startQVACProvider({
  firewall: {
    mode: "allow",
    publicKeys: ["peer-public-key-hex"],
  },
});
console.log("Provider public key:", response.publicKey);

No-firewall variant:

const response = await startQVACProvider();
console.log("Provider public key:", response.publicKey);

On this page