@haven_ai/signer 0.1.37-alpha.0 → 0.2.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 +5 -2
- package/dist/cli.cjs +15 -5
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +15 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +17 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +54 -2
- package/dist/index.d.ts +54 -2
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -186,8 +186,11 @@ what a payload means; they re-derive it.
|
|
|
186
186
|
`from` check is unconditional. The **destination** check is not, and this is
|
|
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
|
-
(`
|
|
190
|
-
|
|
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
|
|
192
|
+
`HAVEN_DELEGATE_KEY` alone — or with a credential
|
|
193
|
+
whose account address is absent — and there is no local value to compare
|
|
191
194
|
against, so the destination is authenticated by Haven's binding signature and
|
|
192
195
|
the token/chain canonicality check, but not independently re-derived. Prefer
|
|
193
196
|
a credential file that carries the account address.
|
package/dist/cli.cjs
CHANGED
|
@@ -1151,10 +1151,12 @@ async function loadSignerCredentials(path = process.env.HAVEN_CREDENTIALS) {
|
|
|
1151
1151
|
if (path) return loadFromFile(path);
|
|
1152
1152
|
const envKey = stringField(process.env.HAVEN_DELEGATE_KEY);
|
|
1153
1153
|
if (envKey) {
|
|
1154
|
+
const accountAddress = readAccountAddressEnv(process.env);
|
|
1154
1155
|
return {
|
|
1155
1156
|
delegateKey: envKey,
|
|
1156
1157
|
agentId: stringField(process.env.HAVEN_AGENT_ID),
|
|
1157
|
-
|
|
1158
|
+
accountAddress,
|
|
1159
|
+
safeAddress: accountAddress,
|
|
1158
1160
|
chainId: chainIdField(process.env.HAVEN_CHAIN_ID, "HAVEN_CHAIN_ID"),
|
|
1159
1161
|
network: stringField(process.env.HAVEN_NETWORK),
|
|
1160
1162
|
x402BindingSigner: stringField(process.env.HAVEN_X402_BINDING_SIGNER)
|
|
@@ -1184,10 +1186,12 @@ async function loadFromFile(path) {
|
|
|
1184
1186
|
if (!delegateKey) {
|
|
1185
1187
|
throw new Error("Haven credentials are missing delegate_key \u2014 the edge signer needs it to sign.");
|
|
1186
1188
|
}
|
|
1189
|
+
const accountAddress = readAccountAddressField(raw);
|
|
1187
1190
|
return {
|
|
1188
1191
|
delegateKey,
|
|
1189
1192
|
agentId: stringField(raw.agent_id ?? raw.agentId),
|
|
1190
|
-
|
|
1193
|
+
accountAddress,
|
|
1194
|
+
safeAddress: accountAddress,
|
|
1191
1195
|
chainId: chainIdField(raw.chain_id ?? raw.chainId, "chain_id"),
|
|
1192
1196
|
network: stringField(raw.network),
|
|
1193
1197
|
x402BindingSigner: stringField(
|
|
@@ -1196,6 +1200,12 @@ async function loadFromFile(path) {
|
|
|
1196
1200
|
sourcePath: path
|
|
1197
1201
|
};
|
|
1198
1202
|
}
|
|
1203
|
+
function readAccountAddressField(raw) {
|
|
1204
|
+
return stringField(raw.account_address ?? raw.safe_address ?? raw.safeAddress);
|
|
1205
|
+
}
|
|
1206
|
+
function readAccountAddressEnv(env) {
|
|
1207
|
+
return stringField(env.HAVEN_ACCOUNT_ADDRESS ?? env.HAVEN_WALLET_ADDRESS ?? env.HAVEN_SAFE_ADDRESS);
|
|
1208
|
+
}
|
|
1199
1209
|
function stringField(value) {
|
|
1200
1210
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
1201
1211
|
}
|
|
@@ -1237,7 +1247,7 @@ async function warnIfCredentialFilePermissive(path, log = (message) => process.s
|
|
|
1237
1247
|
|
|
1238
1248
|
// src/server.ts
|
|
1239
1249
|
var SIGNER_NAME = "@haven_ai/signer";
|
|
1240
|
-
var SIGNER_VERSION = "0.
|
|
1250
|
+
var SIGNER_VERSION = "0.2.0-alpha.0";
|
|
1241
1251
|
async function resolveSignerRuntime(options = {}) {
|
|
1242
1252
|
assertSupportedNodeVersion(options.nodeVersion);
|
|
1243
1253
|
if (options.delegateKey) {
|
|
@@ -1272,7 +1282,7 @@ function buildSignerMcpServer(signer, options = {}) {
|
|
|
1272
1282
|
audit: {
|
|
1273
1283
|
auditPath: options.auditPath ?? defaultSigningAuditPath(credentialsPath),
|
|
1274
1284
|
delegateAddress: signer.delegateAddress,
|
|
1275
|
-
safeAddress: options.credentials?.safeAddress,
|
|
1285
|
+
safeAddress: options.credentials?.accountAddress ?? options.credentials?.safeAddress,
|
|
1276
1286
|
chainId: options.credentials?.chainId
|
|
1277
1287
|
},
|
|
1278
1288
|
// #1263: the payment_id signing path — the ONLY network call this server
|
|
@@ -1322,7 +1332,7 @@ async function runSignerConsentGate(signer, credentials, options) {
|
|
|
1322
1332
|
return ensureSignerConsent(
|
|
1323
1333
|
{
|
|
1324
1334
|
delegateAddress: signer.delegateAddress,
|
|
1325
|
-
safeAddress: credentials?.safeAddress,
|
|
1335
|
+
safeAddress: credentials?.accountAddress ?? credentials?.safeAddress,
|
|
1326
1336
|
agentId: credentials?.agentId,
|
|
1327
1337
|
chainId: credentials?.chainId,
|
|
1328
1338
|
network: credentials?.network,
|