TypeScript authentication

import { createEveIacClient, isAuthError, AgentError } from "@eve-iac/sdk";

const anon = createEveIacClient({ url, token: "", caPem });
const session = await anon.login({ username: "admin", password: "secret" });
const client = createEveIacClient({ url, token: session.token ?? "", caPem });
await client.getSession();

getHealth does not require a token.

try {
  await client.getSession();
} catch (err) {
  if (isAuthError(err)) {
    const code = (err as AgentError).code;
    throw new Error(String(code));
  }
  throw err;
}

Pin caPem to the agent certificate. Do not disable TLS verification.