How-to guide

Connect a client

Attach a reference client to a Vault instance using capability tokens.

Informative guidance ahead. For protocol requirements see the relevant specification sections.

Before you begin

Steps

  1. Create a client capability.
    vault-cli capability create \
      --scope=read,write \
      --resource="vault://messages" \
      --label="dev-client"
    
  2. Configure the client SDK.
    import { Client } from '@journalfoundation/vault-sdk';
    
    const client = new Client({
      vaultEndpoint: 'https://localhost:8443',
      capability: process.env.VAULT_CAPABILITY!,
    });
    
  3. Exchange a message.
    await client.messages.send({
      channel: 'demo',
      body: 'Hello, encrypted world!',
    });
    

Troubleshooting

  • Ensure your system clock is accurate; capability tokens are time-bound.
  • TLS errors? Import the development CA certificate exported by the Vault container.

See also