hiloop-sdk 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.js CHANGED
@@ -15,6 +15,10 @@ export class HiloopClient {
15
15
  this.initialized = false;
16
16
  this.initPromise = null;
17
17
  this.apiKey = options.apiKey;
18
+ if (options.apiKey.startsWith("hlp_prov_")) {
19
+ throw new Error("Provisioning keys (hlp_prov_*) cannot be used with HiloopClient. " +
20
+ "Use the agent API key returned by POST /v1/provision/agents instead.");
21
+ }
18
22
  this.baseUrl = (options.baseUrl ?? "https://api.hi-loop.com").replace(/\/$/, "");
19
23
  this.timeout = options.timeout ?? 30000;
20
24
  this.options = options;
@@ -79,8 +83,8 @@ export class HiloopClient {
79
83
  if (!spacePublicKey || !spaceKeyId) {
80
84
  try {
81
85
  const info = await this.rawRequest("GET", "/agent/encryption-info");
82
- spacePublicKey = info.spacePublicKey;
83
- spaceKeyId = info.spaceKeyId;
86
+ spacePublicKey = info.spacePublicKey ?? "";
87
+ spaceKeyId = info.spaceKeyId ?? "";
84
88
  }
85
89
  catch {
86
90
  // Space key not available — crypto operations will fail but non-crypto calls work
package/dist/crypto.js CHANGED
@@ -141,6 +141,10 @@ export class CryptoContext {
141
141
  }
142
142
  /** Compute X25519 ECDH shared secret with the recipient (space) public key. */
143
143
  getSharedSecret() {
144
+ if (!this.recipientPublicKeyB64) {
145
+ throw new Error("Space public key not available. This usually means the space has no encryption keys yet — " +
146
+ "ensure a human user has logged into the space at least once to generate keys.");
147
+ }
144
148
  const sk = util.decodeBase64(this.secretKeyB64);
145
149
  const pk = util.decodeBase64(this.recipientPublicKeyB64);
146
150
  return util.encodeBase64(nacl.scalarMult(sk, pk));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hiloop-sdk",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "TypeScript SDK for Hiloop — zero-trust human-AI agent interaction platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",