Configuration
Environment variables
The SDK reads no globals of its own. An injectable resolver supplies values, so the same code works in Node, Cloudflare Workers, Deno or a test harness.
The model
.env
HIVE_TREASURY_ACCOUNT=my-treasury
HIVE_TREASURY_ACTIVE_KEY=5J...Values are read lazily: creating a client, a configuration or a preview never touches the environment. Only an actual signing call does.
Security
Key variables must never be prefixed with a bundler's public prefix (such as
VITE_). They belong to the server runtime only.Custom resolver
TypeScript
import { HiveClient, createEnvironmentResolver } from "hivexph-sdk";
const hive = new HiveClient({
environment: createEnvironmentResolver((name) => secretsMap[name]),
accounts: {
treasury: { accountEnv: "HIVE_TREASURY_ACCOUNT", keyEnv: "HIVE_TREASURY_ACTIVE_KEY" },
},
});Missing variables
TypeScript
try {
await hive.issuer.token.issue({ from: hive.accounts.treasury, symbol: "MYTOKEN", account: "bob", quantity: "1" });
} catch (error) {
// HiveEnvironmentVariableMissingError:
// Environment variable "HIVE_TREASURY_ACTIVE_KEY" is not set
}Errors name the variable, never its value, so they are safe to log and safe to surface in an operator dashboard.
