@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 +4 -2
- package/dist/cli.cjs +23 -10
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +23 -10
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +23 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -22
- package/dist/index.d.ts +20 -22
- package/dist/index.js +23 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -28,7 +28,7 @@ function createSigningAuditEntry(tool, payloadHash, context, now = /* @__PURE__
|
|
|
28
28
|
payload_hash: payloadHash,
|
|
29
29
|
delegate_address: context.delegateAddress
|
|
30
30
|
};
|
|
31
|
-
if (context.
|
|
31
|
+
if (context.accountAddress) entry.safe_address = context.accountAddress;
|
|
32
32
|
if (typeof context.chainId === "number") entry.chain_id = context.chainId;
|
|
33
33
|
return entry;
|
|
34
34
|
}
|
|
@@ -983,7 +983,7 @@ function createToolHandlers(signer, options = {}) {
|
|
|
983
983
|
authorization: args.authorization,
|
|
984
984
|
expectedAuth: args.expected_auth,
|
|
985
985
|
// Cross-check `to` against the Safe in the local credential when present.
|
|
986
|
-
expectedSafe: options.audit?.
|
|
986
|
+
expectedSafe: options.audit?.accountAddress
|
|
987
987
|
});
|
|
988
988
|
await auditSigning(
|
|
989
989
|
"haven_sign_sweep_delegate",
|
|
@@ -1108,7 +1108,7 @@ var SIGNER_CONSENT_SURFACE_VERSION = 2;
|
|
|
1108
1108
|
function computeSignerConsentHash(input) {
|
|
1109
1109
|
const identity = [
|
|
1110
1110
|
input.delegateAddress.toLowerCase(),
|
|
1111
|
-
(input.
|
|
1111
|
+
(input.accountAddress ?? "").toLowerCase(),
|
|
1112
1112
|
input.agentId ?? "",
|
|
1113
1113
|
input.chainId ?? "",
|
|
1114
1114
|
input.network ?? ""
|
|
@@ -1127,7 +1127,7 @@ function renderSignerConsentBlock(input, hash) {
|
|
|
1127
1127
|
"",
|
|
1128
1128
|
`Delegate address: ${input.delegateAddress}`
|
|
1129
1129
|
];
|
|
1130
|
-
lines.push(`Haven wallet: ${input.
|
|
1130
|
+
lines.push(`Haven wallet: ${input.accountAddress ?? "not provided to this signer"}`);
|
|
1131
1131
|
if (input.agentId) lines.push(`Agent ID: ${input.agentId}`);
|
|
1132
1132
|
if (typeof input.chainId === "number") lines.push(`Chain ID: ${input.chainId}`);
|
|
1133
1133
|
if (input.network) lines.push(`Network: ${input.network}`);
|
|
@@ -1229,7 +1229,6 @@ async function loadSignerCredentials(path = process.env.HAVEN_CREDENTIALS) {
|
|
|
1229
1229
|
delegateKey: envKey,
|
|
1230
1230
|
agentId: stringField(process.env.HAVEN_AGENT_ID),
|
|
1231
1231
|
accountAddress,
|
|
1232
|
-
safeAddress: accountAddress,
|
|
1233
1232
|
chainId: chainIdField(process.env.HAVEN_CHAIN_ID, "HAVEN_CHAIN_ID"),
|
|
1234
1233
|
network: stringField(process.env.HAVEN_NETWORK),
|
|
1235
1234
|
x402BindingSigner: stringField(process.env.HAVEN_X402_BINDING_SIGNER)
|
|
@@ -1264,7 +1263,6 @@ async function loadFromFile(path) {
|
|
|
1264
1263
|
delegateKey,
|
|
1265
1264
|
agentId: stringField(raw.agent_id ?? raw.agentId),
|
|
1266
1265
|
accountAddress,
|
|
1267
|
-
safeAddress: accountAddress,
|
|
1268
1266
|
chainId: chainIdField(raw.chain_id ?? raw.chainId, "chain_id"),
|
|
1269
1267
|
network: stringField(raw.network),
|
|
1270
1268
|
x402BindingSigner: stringField(
|
|
@@ -1277,7 +1275,22 @@ function readAccountAddressField(raw) {
|
|
|
1277
1275
|
return stringField(raw.account_address ?? raw.safe_address ?? raw.safeAddress);
|
|
1278
1276
|
}
|
|
1279
1277
|
function readAccountAddressEnv(env) {
|
|
1280
|
-
|
|
1278
|
+
const current = stringField(env.HAVEN_ACCOUNT_ADDRESS);
|
|
1279
|
+
for (const name of ["HAVEN_WALLET_ADDRESS", "HAVEN_SAFE_ADDRESS"]) {
|
|
1280
|
+
const retired = stringField(env[name]);
|
|
1281
|
+
if (!retired) continue;
|
|
1282
|
+
if (!current) {
|
|
1283
|
+
throw new Error(
|
|
1284
|
+
`${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.`
|
|
1285
|
+
);
|
|
1286
|
+
}
|
|
1287
|
+
if (retired.toLowerCase() !== current.toLowerCase()) {
|
|
1288
|
+
throw new Error(
|
|
1289
|
+
`${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.`
|
|
1290
|
+
);
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
return current;
|
|
1281
1294
|
}
|
|
1282
1295
|
function stringField(value) {
|
|
1283
1296
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
@@ -1320,7 +1333,7 @@ async function warnIfCredentialFilePermissive(path, log = (message) => process.s
|
|
|
1320
1333
|
|
|
1321
1334
|
// src/server.ts
|
|
1322
1335
|
var SIGNER_NAME = "@haven_ai/signer";
|
|
1323
|
-
var SIGNER_VERSION = "0.
|
|
1336
|
+
var SIGNER_VERSION = "0.3.0-alpha.0";
|
|
1324
1337
|
async function resolveSignerRuntime(options = {}) {
|
|
1325
1338
|
assertSupportedNodeVersion(options.nodeVersion);
|
|
1326
1339
|
if (options.delegateKey) {
|
|
@@ -1355,7 +1368,7 @@ function buildSignerMcpServer(signer, options = {}) {
|
|
|
1355
1368
|
audit: {
|
|
1356
1369
|
auditPath: options.auditPath ?? defaultSigningAuditPath(credentialsPath),
|
|
1357
1370
|
delegateAddress: signer.delegateAddress,
|
|
1358
|
-
|
|
1371
|
+
accountAddress: options.credentials?.accountAddress,
|
|
1359
1372
|
chainId: options.credentials?.chainId
|
|
1360
1373
|
},
|
|
1361
1374
|
// #1263: the payment_id signing path — the ONLY network call this server
|
|
@@ -1405,7 +1418,7 @@ async function runSignerConsentGate(signer, credentials, options) {
|
|
|
1405
1418
|
return ensureSignerConsent(
|
|
1406
1419
|
{
|
|
1407
1420
|
delegateAddress: signer.delegateAddress,
|
|
1408
|
-
|
|
1421
|
+
accountAddress: credentials?.accountAddress,
|
|
1409
1422
|
agentId: credentials?.agentId,
|
|
1410
1423
|
chainId: credentials?.chainId,
|
|
1411
1424
|
network: credentials?.network,
|