@haven_ai/signer 0.2.1-alpha.0 → 0.3.0-alpha.0

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/README.md CHANGED
@@ -187,8 +187,10 @@ what a payload means; they re-derive it.
187
187
  the one asymmetry in this list: the signer compares the sweep's `to` against
188
188
  the account address **only when the local credential records one**
189
189
  (`account_address`, or the pre-#2908 `safe_address` / `safeAddress`, which
190
- are read permanently; from the environment, `HAVEN_ACCOUNT_ADDRESS`, or the
191
- older `HAVEN_WALLET_ADDRESS` / `HAVEN_SAFE_ADDRESS` until #2914). Run with
190
+ are read permanently; from the environment, `HAVEN_ACCOUNT_ADDRESS` only —
191
+ `HAVEN_WALLET_ADDRESS` and `HAVEN_SAFE_ADDRESS` were removed by #2914, so a
192
+ machine still configured through either records no account address and lands
193
+ in exactly the degraded case this paragraph describes). Run with
192
194
  `HAVEN_DELEGATE_KEY` alone — or with a credential
193
195
  whose account address is absent — and there is no local value to compare
194
196
  against, so the destination is authenticated by Haven's binding signature and
package/dist/cli.cjs CHANGED
@@ -30,7 +30,7 @@ function createSigningAuditEntry(tool, payloadHash, context, now = /* @__PURE__
30
30
  payload_hash: payloadHash,
31
31
  delegate_address: context.delegateAddress
32
32
  };
33
- if (context.safeAddress) entry.safe_address = context.safeAddress;
33
+ if (context.accountAddress) entry.safe_address = context.accountAddress;
34
34
  if (typeof context.chainId === "number") entry.chain_id = context.chainId;
35
35
  return entry;
36
36
  }
@@ -985,7 +985,7 @@ function createToolHandlers(signer, options = {}) {
985
985
  authorization: args.authorization,
986
986
  expectedAuth: args.expected_auth,
987
987
  // Cross-check `to` against the Safe in the local credential when present.
988
- expectedSafe: options.audit?.safeAddress
988
+ expectedSafe: options.audit?.accountAddress
989
989
  });
990
990
  await auditSigning(
991
991
  "haven_sign_sweep_delegate",
@@ -1110,7 +1110,7 @@ var SIGNER_CONSENT_SURFACE_VERSION = 2;
1110
1110
  function computeSignerConsentHash(input) {
1111
1111
  const identity = [
1112
1112
  input.delegateAddress.toLowerCase(),
1113
- (input.safeAddress ?? "").toLowerCase(),
1113
+ (input.accountAddress ?? "").toLowerCase(),
1114
1114
  input.agentId ?? "",
1115
1115
  input.chainId ?? "",
1116
1116
  input.network ?? ""
@@ -1129,7 +1129,7 @@ function renderSignerConsentBlock(input, hash) {
1129
1129
  "",
1130
1130
  `Delegate address: ${input.delegateAddress}`
1131
1131
  ];
1132
- lines.push(`Haven wallet: ${input.safeAddress ?? "not provided to this signer"}`);
1132
+ lines.push(`Haven wallet: ${input.accountAddress ?? "not provided to this signer"}`);
1133
1133
  if (input.agentId) lines.push(`Agent ID: ${input.agentId}`);
1134
1134
  if (typeof input.chainId === "number") lines.push(`Chain ID: ${input.chainId}`);
1135
1135
  if (input.network) lines.push(`Network: ${input.network}`);
@@ -1231,7 +1231,6 @@ async function loadSignerCredentials(path = process.env.HAVEN_CREDENTIALS) {
1231
1231
  delegateKey: envKey,
1232
1232
  agentId: stringField(process.env.HAVEN_AGENT_ID),
1233
1233
  accountAddress,
1234
- safeAddress: accountAddress,
1235
1234
  chainId: chainIdField(process.env.HAVEN_CHAIN_ID, "HAVEN_CHAIN_ID"),
1236
1235
  network: stringField(process.env.HAVEN_NETWORK),
1237
1236
  x402BindingSigner: stringField(process.env.HAVEN_X402_BINDING_SIGNER)
@@ -1266,7 +1265,6 @@ async function loadFromFile(path) {
1266
1265
  delegateKey,
1267
1266
  agentId: stringField(raw.agent_id ?? raw.agentId),
1268
1267
  accountAddress,
1269
- safeAddress: accountAddress,
1270
1268
  chainId: chainIdField(raw.chain_id ?? raw.chainId, "chain_id"),
1271
1269
  network: stringField(raw.network),
1272
1270
  x402BindingSigner: stringField(
@@ -1279,7 +1277,22 @@ function readAccountAddressField(raw) {
1279
1277
  return stringField(raw.account_address ?? raw.safe_address ?? raw.safeAddress);
1280
1278
  }
1281
1279
  function readAccountAddressEnv(env) {
1282
- return stringField(env.HAVEN_ACCOUNT_ADDRESS ?? env.HAVEN_WALLET_ADDRESS ?? env.HAVEN_SAFE_ADDRESS);
1280
+ const current = stringField(env.HAVEN_ACCOUNT_ADDRESS);
1281
+ for (const name of ["HAVEN_WALLET_ADDRESS", "HAVEN_SAFE_ADDRESS"]) {
1282
+ const retired = stringField(env[name]);
1283
+ if (!retired) continue;
1284
+ if (!current) {
1285
+ throw new Error(
1286
+ `${name} is retired (#2906) \u2014 Haven accounts are addressed as accounts, not Safes. Set HAVEN_ACCOUNT_ADDRESS to the same value. Refusing rather than ignoring it, because an unset account address silently skips the sweep-destination check.`
1287
+ );
1288
+ }
1289
+ if (retired.toLowerCase() !== current.toLowerCase()) {
1290
+ throw new Error(
1291
+ `${name} and HAVEN_ACCOUNT_ADDRESS were both set to different addresses. Remove the retired name, or make them match \u2014 picking one silently would hide the mismatch.`
1292
+ );
1293
+ }
1294
+ }
1295
+ return current;
1283
1296
  }
1284
1297
  function stringField(value) {
1285
1298
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
@@ -1322,7 +1335,7 @@ async function warnIfCredentialFilePermissive(path, log = (message) => process.s
1322
1335
 
1323
1336
  // src/server.ts
1324
1337
  var SIGNER_NAME = "@haven_ai/signer";
1325
- var SIGNER_VERSION = "0.2.1-alpha.0";
1338
+ var SIGNER_VERSION = "0.3.0-alpha.0";
1326
1339
  async function resolveSignerRuntime(options = {}) {
1327
1340
  assertSupportedNodeVersion(options.nodeVersion);
1328
1341
  if (options.delegateKey) {
@@ -1357,7 +1370,7 @@ function buildSignerMcpServer(signer, options = {}) {
1357
1370
  audit: {
1358
1371
  auditPath: options.auditPath ?? defaultSigningAuditPath(credentialsPath),
1359
1372
  delegateAddress: signer.delegateAddress,
1360
- safeAddress: options.credentials?.accountAddress ?? options.credentials?.safeAddress,
1373
+ accountAddress: options.credentials?.accountAddress,
1361
1374
  chainId: options.credentials?.chainId
1362
1375
  },
1363
1376
  // #1263: the payment_id signing path — the ONLY network call this server
@@ -1407,7 +1420,7 @@ async function runSignerConsentGate(signer, credentials, options) {
1407
1420
  return ensureSignerConsent(
1408
1421
  {
1409
1422
  delegateAddress: signer.delegateAddress,
1410
- safeAddress: credentials?.accountAddress ?? credentials?.safeAddress,
1423
+ accountAddress: credentials?.accountAddress,
1411
1424
  agentId: credentials?.agentId,
1412
1425
  chainId: credentials?.chainId,
1413
1426
  network: credentials?.network,