@vapi-network/core 0.14.0 → 0.15.1
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 +1 -1
- package/dist/agent-link.d.ts +7 -0
- package/dist/agent-link.d.ts.map +1 -1
- package/dist/agent-link.js +212 -98
- package/dist/agent-link.js.map +3 -3
- package/dist/atomic-file.d.ts +4 -0
- package/dist/atomic-file.d.ts.map +1 -1
- package/dist/backup.d.ts.map +1 -1
- package/dist/backup.js +203 -147
- package/dist/backup.js.map +3 -3
- package/dist/cloud-backup.js +314 -199
- package/dist/cloud-backup.js.map +3 -3
- package/dist/discovery.d.ts +2 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/docs.d.ts.map +1 -1
- package/dist/http-response.d.ts +7 -0
- package/dist/http-response.d.ts.map +1 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3729 -2624
- package/dist/index.js.map +3 -3
- package/dist/keystore-error.d.ts +4 -0
- package/dist/keystore-error.d.ts.map +1 -0
- package/dist/keystore.d.ts +1 -4
- package/dist/keystore.d.ts.map +1 -1
- package/dist/payment-warning.d.ts +12 -0
- package/dist/payment-warning.d.ts.map +1 -0
- package/dist/receipts.d.ts +5 -0
- package/dist/receipts.d.ts.map +1 -1
- package/dist/router-client.d.ts +107 -7
- package/dist/router-client.d.ts.map +1 -1
- package/dist/router-client.js +18034 -17198
- package/dist/router-client.js.map +3 -3
- package/dist/secrets.js +66 -43
- package/dist/secrets.js.map +2 -2
- package/dist/spend-policy.d.ts.map +1 -1
- package/dist/support-report.d.ts +1 -1
- package/dist/svm.d.ts.map +1 -1
- package/dist/swarm-capital.d.ts +70 -0
- package/dist/swarm-capital.d.ts.map +1 -1
- package/dist/swarm-workers.d.ts +4 -0
- package/dist/swarm-workers.d.ts.map +1 -0
- package/dist/swarm.d.ts +1 -1
- package/dist/swarm.d.ts.map +1 -1
- package/dist/tasks.js +141 -71
- package/dist/tasks.js.map +2 -2
- package/dist/transfer.d.ts.map +1 -1
- package/dist/wallet-store.d.ts +77 -0
- package/dist/wallet-store.d.ts.map +1 -1
- package/dist/x402-pay.d.ts +10 -2
- package/dist/x402-pay.d.ts.map +1 -1
- package/dist/x402.d.ts +10 -6
- package/dist/x402.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/backup.js
CHANGED
|
@@ -45540,11 +45540,14 @@ async function writeJsonAtomic(path, value, options = {}) {
|
|
|
45540
45540
|
await handle.close();
|
|
45541
45541
|
handle = void 0;
|
|
45542
45542
|
await rename(temporaryPath, path);
|
|
45543
|
-
|
|
45544
|
-
|
|
45545
|
-
|
|
45546
|
-
|
|
45547
|
-
|
|
45543
|
+
if (process.platform !== "win32") {
|
|
45544
|
+
const directoryHandle = await open2(directory, "r");
|
|
45545
|
+
try {
|
|
45546
|
+
await atomicFileTestHooks?.beforeDirectorySync?.(directory);
|
|
45547
|
+
await directoryHandle.sync();
|
|
45548
|
+
} finally {
|
|
45549
|
+
await directoryHandle.close();
|
|
45550
|
+
}
|
|
45548
45551
|
}
|
|
45549
45552
|
} catch (error61) {
|
|
45550
45553
|
await handle?.close().catch(() => void 0);
|
|
@@ -45562,38 +45565,43 @@ async function withFileLock(lockPath, fn, options = {}) {
|
|
|
45562
45565
|
const owner = JSON.stringify(ownerRecord);
|
|
45563
45566
|
const releasedOwner = JSON.stringify({ ...ownerRecord, released: true });
|
|
45564
45567
|
let handle;
|
|
45565
|
-
|
|
45566
|
-
|
|
45567
|
-
|
|
45568
|
-
const candidate = await open2(lockPath, "wx", 384);
|
|
45568
|
+
try {
|
|
45569
|
+
while (handle === void 0) {
|
|
45570
|
+
await atomicFileTestHooks?.beforeLockAttempt?.(lockPath);
|
|
45569
45571
|
try {
|
|
45570
|
-
await
|
|
45571
|
-
|
|
45572
|
-
|
|
45573
|
-
|
|
45574
|
-
await
|
|
45575
|
-
await
|
|
45576
|
-
|
|
45577
|
-
|
|
45578
|
-
|
|
45572
|
+
const candidate = await open2(lockPath, "wx", 384);
|
|
45573
|
+
try {
|
|
45574
|
+
await candidate.writeFile(owner, "utf8");
|
|
45575
|
+
await candidate.sync();
|
|
45576
|
+
await atomicFileTestHooks?.afterLockCreate?.(lockPath);
|
|
45577
|
+
if (await lockTakeoverInProgress(lockPath)) {
|
|
45578
|
+
await candidate.close();
|
|
45579
|
+
await removeOwnedLock(lockPath, [owner]);
|
|
45580
|
+
await removeAbandonedLockTombs(lockPath);
|
|
45581
|
+
if (Date.now() >= deadline) {
|
|
45582
|
+
throw new FileLockedError(options.lockedMessage);
|
|
45583
|
+
}
|
|
45584
|
+
await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_MS));
|
|
45585
|
+
continue;
|
|
45579
45586
|
}
|
|
45580
|
-
|
|
45581
|
-
|
|
45587
|
+
handle = candidate;
|
|
45588
|
+
} catch (error61) {
|
|
45589
|
+
await candidate.close().catch(() => void 0);
|
|
45590
|
+
await removeOwnedLock(lockPath, [owner]).catch(() => void 0);
|
|
45591
|
+
throw error61;
|
|
45582
45592
|
}
|
|
45583
|
-
handle = candidate;
|
|
45584
45593
|
} catch (error61) {
|
|
45585
|
-
|
|
45586
|
-
await
|
|
45587
|
-
|
|
45588
|
-
|
|
45589
|
-
|
|
45590
|
-
|
|
45591
|
-
await removeStaleLock(lockPath);
|
|
45592
|
-
if (Date.now() >= deadline) {
|
|
45593
|
-
throw new FileLockedError(options.lockedMessage);
|
|
45594
|
+
if (!hasCode(error61, "EEXIST")) throw error61;
|
|
45595
|
+
await removeStaleLock(lockPath);
|
|
45596
|
+
if (Date.now() >= deadline) {
|
|
45597
|
+
throw new FileLockedError(options.lockedMessage);
|
|
45598
|
+
}
|
|
45599
|
+
await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_MS));
|
|
45594
45600
|
}
|
|
45595
|
-
await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_MS));
|
|
45596
45601
|
}
|
|
45602
|
+
} catch (error61) {
|
|
45603
|
+
await removeOwnedTombs(lockPath, [owner]).catch(() => void 0);
|
|
45604
|
+
throw error61;
|
|
45597
45605
|
}
|
|
45598
45606
|
const ownedHandle = handle;
|
|
45599
45607
|
const heartbeat = setInterval(() => {
|
|
@@ -45606,13 +45614,18 @@ async function withFileLock(lockPath, fn, options = {}) {
|
|
|
45606
45614
|
} finally {
|
|
45607
45615
|
clearInterval(heartbeat);
|
|
45608
45616
|
try {
|
|
45609
|
-
await markLockReleased(ownedHandle, releasedOwner);
|
|
45610
|
-
} finally {
|
|
45611
45617
|
try {
|
|
45612
|
-
await
|
|
45618
|
+
await atomicFileTestHooks?.beforeLockRelease?.(lockPath);
|
|
45619
|
+
await markLockReleased(ownedHandle, releasedOwner);
|
|
45613
45620
|
} finally {
|
|
45614
|
-
|
|
45621
|
+
try {
|
|
45622
|
+
await ownedHandle.close();
|
|
45623
|
+
await atomicFileTestHooks?.afterLockHandleClose?.(lockPath);
|
|
45624
|
+
} finally {
|
|
45625
|
+
await removeOwnedLock(lockPath, [owner, releasedOwner]);
|
|
45626
|
+
}
|
|
45615
45627
|
}
|
|
45628
|
+
} catch {
|
|
45616
45629
|
}
|
|
45617
45630
|
}
|
|
45618
45631
|
}
|
|
@@ -45649,8 +45662,9 @@ async function removeOwnedLock(path, owners) {
|
|
|
45649
45662
|
throw error61;
|
|
45650
45663
|
}
|
|
45651
45664
|
let pendingError;
|
|
45665
|
+
let renamedOwner;
|
|
45652
45666
|
try {
|
|
45653
|
-
|
|
45667
|
+
renamedOwner = await readFile(tombPath, "utf8");
|
|
45654
45668
|
if (!owners.includes(renamedOwner) && !lockOwnerReleased(renamedOwner)) {
|
|
45655
45669
|
await atomicFileTestHooks?.afterMismatchedLockRename?.(path);
|
|
45656
45670
|
const currentOwner = await readFile(tombPath, "utf8");
|
|
@@ -45661,9 +45675,13 @@ async function removeOwnedLock(path, owners) {
|
|
|
45661
45675
|
pendingError = error61;
|
|
45662
45676
|
}
|
|
45663
45677
|
try {
|
|
45678
|
+
await atomicFileTestHooks?.beforeTombUnlink?.(tombPath);
|
|
45664
45679
|
await unlink(tombPath);
|
|
45665
45680
|
} catch (error61) {
|
|
45666
|
-
if (!
|
|
45681
|
+
if (!tombUnlinkTolerated(
|
|
45682
|
+
error61,
|
|
45683
|
+
renamedOwner !== void 0 && lockOwnerReleased(renamedOwner) && owners.includes(renamedOwner)
|
|
45684
|
+
) && pendingError === void 0) {
|
|
45667
45685
|
pendingError = error61;
|
|
45668
45686
|
}
|
|
45669
45687
|
}
|
|
@@ -45688,7 +45706,7 @@ async function removeAbandonedLockTombs(path) {
|
|
|
45688
45706
|
const abandoned = lockOwnerReleased(owner) || Date.now() - metadata.mtimeMs > LOCK_STALE_AFTER_MS && (pid === void 0 || !processIsAlive(pid));
|
|
45689
45707
|
if (!abandoned) continue;
|
|
45690
45708
|
await unlink(tombPath).catch((error61) => {
|
|
45691
|
-
if (!
|
|
45709
|
+
if (!tombUnlinkTolerated(error61, true)) throw error61;
|
|
45692
45710
|
});
|
|
45693
45711
|
}
|
|
45694
45712
|
}
|
|
@@ -45700,9 +45718,12 @@ async function removeOwnedTombs(path, owners) {
|
|
|
45700
45718
|
const tombPath = join2(directory, entry);
|
|
45701
45719
|
const owner = await readFile(tombPath, "utf8").catch(() => void 0);
|
|
45702
45720
|
if (owner === void 0 || !owners.includes(owner)) continue;
|
|
45703
|
-
|
|
45704
|
-
|
|
45705
|
-
|
|
45721
|
+
try {
|
|
45722
|
+
await atomicFileTestHooks?.beforeTombUnlink?.(tombPath);
|
|
45723
|
+
await unlink(tombPath);
|
|
45724
|
+
} catch (error61) {
|
|
45725
|
+
if (!tombUnlinkTolerated(error61, lockOwnerReleased(owner))) throw error61;
|
|
45726
|
+
}
|
|
45706
45727
|
}
|
|
45707
45728
|
}
|
|
45708
45729
|
async function restoreRenamedLock(path, tombPath) {
|
|
@@ -45752,6 +45773,9 @@ function processIsAlive(pid) {
|
|
|
45752
45773
|
return hasCode(error61, "EPERM");
|
|
45753
45774
|
}
|
|
45754
45775
|
}
|
|
45776
|
+
function tombUnlinkTolerated(error61, reapable) {
|
|
45777
|
+
return hasCode(error61, "ENOENT") || reapable && process.platform === "win32" && (hasCode(error61, "EPERM") || hasCode(error61, "EBUSY"));
|
|
45778
|
+
}
|
|
45755
45779
|
function hasCode(error61, code) {
|
|
45756
45780
|
return error61 instanceof Error && "code" in error61 && error61.code === code;
|
|
45757
45781
|
}
|
|
@@ -46363,114 +46387,13 @@ function deviceName(args = {}) {
|
|
|
46363
46387
|
return slugifyDeviceName(args.hostname ?? operatingSystemHostname());
|
|
46364
46388
|
}
|
|
46365
46389
|
|
|
46366
|
-
// src/keystore.ts
|
|
46367
|
-
import { createCipheriv, createDecipheriv, randomBytes as randomBytes3, scrypt } from "node:crypto";
|
|
46368
|
-
var SCRYPT_N = 2 ** 15;
|
|
46369
|
-
var SCRYPT_R = 8;
|
|
46370
|
-
var SCRYPT_P = 1;
|
|
46371
|
-
var KEY_LENGTH = 32;
|
|
46372
|
-
var SCRYPT_MAX_MEMORY = 64 * 1024 * 1024;
|
|
46373
|
-
var AUTH_TAG_LENGTH = 16;
|
|
46374
|
-
var cryptoSchema = external_exports.object({
|
|
46375
|
-
cipher: external_exports.literal("aes-256-gcm"),
|
|
46376
|
-
ciphertext: external_exports.string(),
|
|
46377
|
-
iv: external_exports.string(),
|
|
46378
|
-
authTag: external_exports.string(),
|
|
46379
|
-
kdf: external_exports.literal("scrypt"),
|
|
46380
|
-
salt: external_exports.string(),
|
|
46381
|
-
kdfParams: external_exports.object({
|
|
46382
|
-
n: external_exports.literal(SCRYPT_N),
|
|
46383
|
-
r: external_exports.literal(SCRYPT_R),
|
|
46384
|
-
p: external_exports.literal(SCRYPT_P),
|
|
46385
|
-
dkLen: external_exports.literal(KEY_LENGTH)
|
|
46386
|
-
})
|
|
46387
|
-
});
|
|
46388
|
-
var legacyKeystoreSchema = external_exports.object({
|
|
46389
|
-
version: external_exports.literal(1),
|
|
46390
|
-
address: external_exports.string(),
|
|
46391
|
-
crypto: cryptoSchema
|
|
46392
|
-
});
|
|
46393
|
-
var keystoreSchema = external_exports.object({
|
|
46394
|
-
version: external_exports.literal(2),
|
|
46395
|
-
address: external_exports.string(),
|
|
46396
|
-
keys: external_exports.object({
|
|
46397
|
-
evm: external_exports.object({
|
|
46398
|
-
type: external_exports.literal("secp256k1"),
|
|
46399
|
-
address: external_exports.string()
|
|
46400
|
-
}),
|
|
46401
|
-
solana: external_exports.object({
|
|
46402
|
-
type: external_exports.literal("ed25519"),
|
|
46403
|
-
address: external_exports.string()
|
|
46404
|
-
}).optional()
|
|
46405
|
-
}),
|
|
46406
|
-
crypto: cryptoSchema
|
|
46407
|
-
});
|
|
46408
|
-
var keystoreV3Schema = external_exports.object({
|
|
46409
|
-
version: external_exports.literal(3),
|
|
46410
|
-
address: external_exports.string(),
|
|
46411
|
-
keys: external_exports.object({
|
|
46412
|
-
evm: external_exports.object({
|
|
46413
|
-
type: external_exports.literal("secp256k1"),
|
|
46414
|
-
address: external_exports.string(),
|
|
46415
|
-
path: external_exports.string()
|
|
46416
|
-
}),
|
|
46417
|
-
solana: external_exports.object({
|
|
46418
|
-
type: external_exports.literal("ed25519"),
|
|
46419
|
-
address: external_exports.string(),
|
|
46420
|
-
path: external_exports.string()
|
|
46421
|
-
}).optional()
|
|
46422
|
-
}),
|
|
46423
|
-
crypto: cryptoSchema
|
|
46424
|
-
});
|
|
46425
|
-
var encryptedKeysSchema = external_exports.object({
|
|
46426
|
-
keys: external_exports.object({
|
|
46427
|
-
evm: external_exports.string().regex(/^0x[0-9a-fA-F]{64}$/),
|
|
46428
|
-
solana: external_exports.string().optional()
|
|
46429
|
-
})
|
|
46430
|
-
});
|
|
46431
|
-
var encryptedEntropySchema = external_exports.object({ entropy: external_exports.string() });
|
|
46390
|
+
// src/keystore-error.ts
|
|
46432
46391
|
var KeystoreError = class extends Error {
|
|
46433
46392
|
constructor(message, options) {
|
|
46434
46393
|
super(message, options);
|
|
46435
46394
|
this.name = "KeystoreError";
|
|
46436
46395
|
}
|
|
46437
46396
|
};
|
|
46438
|
-
function encryptWithKey(key, plaintext) {
|
|
46439
|
-
if (key.byteLength !== KEY_LENGTH) {
|
|
46440
|
-
throw new Error(`Expected a ${KEY_LENGTH}-byte AES-256-GCM key.`);
|
|
46441
|
-
}
|
|
46442
|
-
const nonce = randomBytes3(12);
|
|
46443
|
-
const cipher = createCipheriv("aes-256-gcm", key, nonce, {
|
|
46444
|
-
authTagLength: AUTH_TAG_LENGTH
|
|
46445
|
-
});
|
|
46446
|
-
const ciphertext = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
46447
|
-
return { nonce, ciphertext, tag: cipher.getAuthTag() };
|
|
46448
|
-
}
|
|
46449
|
-
function decryptWithKey(key, sealed) {
|
|
46450
|
-
if (key.byteLength !== KEY_LENGTH) {
|
|
46451
|
-
throw new Error(`Expected a ${KEY_LENGTH}-byte AES-256-GCM key.`);
|
|
46452
|
-
}
|
|
46453
|
-
if (sealed.nonce.byteLength !== 12) {
|
|
46454
|
-
throw new Error("Expected a 12-byte AES-GCM nonce.");
|
|
46455
|
-
}
|
|
46456
|
-
if (sealed.tag.byteLength !== AUTH_TAG_LENGTH) {
|
|
46457
|
-
throw new Error(`Expected a ${AUTH_TAG_LENGTH}-byte AES-GCM authentication tag.`);
|
|
46458
|
-
}
|
|
46459
|
-
const decipher = createDecipheriv("aes-256-gcm", key, sealed.nonce, {
|
|
46460
|
-
authTagLength: AUTH_TAG_LENGTH
|
|
46461
|
-
});
|
|
46462
|
-
decipher.setAuthTag(sealed.tag);
|
|
46463
|
-
return Buffer.concat([decipher.update(sealed.ciphertext), decipher.final()]);
|
|
46464
|
-
}
|
|
46465
|
-
function validatePrivateKey(value) {
|
|
46466
|
-
const normalized = value.trim().toLowerCase();
|
|
46467
|
-
if (!/^0x[0-9a-f]{64}$/u.test(normalized)) {
|
|
46468
|
-
throw new KeystoreError(
|
|
46469
|
-
"A private key is 0x followed by 64 hexadecimal characters. Check for a missing character."
|
|
46470
|
-
);
|
|
46471
|
-
}
|
|
46472
|
-
return normalized;
|
|
46473
|
-
}
|
|
46474
46397
|
|
|
46475
46398
|
// src/hd.ts
|
|
46476
46399
|
var EVM_DERIVATION_PATH = "m/44'/60'/0'/0/0";
|
|
@@ -46511,7 +46434,7 @@ import { chmod, mkdir as mkdir6, open as open5, readFile as readFile7, readdir a
|
|
|
46511
46434
|
import { join as join6 } from "node:path";
|
|
46512
46435
|
|
|
46513
46436
|
// src/account-movement-lock.ts
|
|
46514
|
-
import { randomBytes as
|
|
46437
|
+
import { randomBytes as randomBytes3 } from "node:crypto";
|
|
46515
46438
|
import { mkdir as mkdir4, open as open3, readFile as readFile4, stat as stat3, unlink as unlink3 } from "node:fs/promises";
|
|
46516
46439
|
import { join as join5 } from "node:path";
|
|
46517
46440
|
var AccountMovementLockedError = class extends Error {
|
|
@@ -46528,7 +46451,7 @@ async function withAccountMovementLock(home, account, timeoutMs, operation, sign
|
|
|
46528
46451
|
await mkdir4(directory, { recursive: true, mode: 448 });
|
|
46529
46452
|
const path = join5(directory, `.${account}.lock`);
|
|
46530
46453
|
const deadline = Date.now() + (timeoutMs ?? 2e3);
|
|
46531
|
-
const owner = JSON.stringify({ pid: process.pid, token:
|
|
46454
|
+
const owner = JSON.stringify({ pid: process.pid, token: randomBytes3(16).toString("hex") });
|
|
46532
46455
|
let handle;
|
|
46533
46456
|
while (handle === void 0) {
|
|
46534
46457
|
signal?.throwIfAborted();
|
|
@@ -46740,6 +46663,109 @@ function receiptWallet(receipt) {
|
|
|
46740
46663
|
return receipt.wallet ?? DEFAULT_WALLET_NAME;
|
|
46741
46664
|
}
|
|
46742
46665
|
|
|
46666
|
+
// src/keystore.ts
|
|
46667
|
+
import { createCipheriv, createDecipheriv, randomBytes as randomBytes4, scrypt } from "node:crypto";
|
|
46668
|
+
var SCRYPT_N = 2 ** 15;
|
|
46669
|
+
var SCRYPT_R = 8;
|
|
46670
|
+
var SCRYPT_P = 1;
|
|
46671
|
+
var KEY_LENGTH = 32;
|
|
46672
|
+
var SCRYPT_MAX_MEMORY = 64 * 1024 * 1024;
|
|
46673
|
+
var AUTH_TAG_LENGTH = 16;
|
|
46674
|
+
var cryptoSchema = external_exports.object({
|
|
46675
|
+
cipher: external_exports.literal("aes-256-gcm"),
|
|
46676
|
+
ciphertext: external_exports.string(),
|
|
46677
|
+
iv: external_exports.string(),
|
|
46678
|
+
authTag: external_exports.string(),
|
|
46679
|
+
kdf: external_exports.literal("scrypt"),
|
|
46680
|
+
salt: external_exports.string(),
|
|
46681
|
+
kdfParams: external_exports.object({
|
|
46682
|
+
n: external_exports.literal(SCRYPT_N),
|
|
46683
|
+
r: external_exports.literal(SCRYPT_R),
|
|
46684
|
+
p: external_exports.literal(SCRYPT_P),
|
|
46685
|
+
dkLen: external_exports.literal(KEY_LENGTH)
|
|
46686
|
+
})
|
|
46687
|
+
});
|
|
46688
|
+
var legacyKeystoreSchema = external_exports.object({
|
|
46689
|
+
version: external_exports.literal(1),
|
|
46690
|
+
address: external_exports.string(),
|
|
46691
|
+
crypto: cryptoSchema
|
|
46692
|
+
});
|
|
46693
|
+
var keystoreSchema = external_exports.object({
|
|
46694
|
+
version: external_exports.literal(2),
|
|
46695
|
+
address: external_exports.string(),
|
|
46696
|
+
keys: external_exports.object({
|
|
46697
|
+
evm: external_exports.object({
|
|
46698
|
+
type: external_exports.literal("secp256k1"),
|
|
46699
|
+
address: external_exports.string()
|
|
46700
|
+
}),
|
|
46701
|
+
solana: external_exports.object({
|
|
46702
|
+
type: external_exports.literal("ed25519"),
|
|
46703
|
+
address: external_exports.string()
|
|
46704
|
+
}).optional()
|
|
46705
|
+
}),
|
|
46706
|
+
crypto: cryptoSchema
|
|
46707
|
+
});
|
|
46708
|
+
var keystoreV3Schema = external_exports.object({
|
|
46709
|
+
version: external_exports.literal(3),
|
|
46710
|
+
address: external_exports.string(),
|
|
46711
|
+
keys: external_exports.object({
|
|
46712
|
+
evm: external_exports.object({
|
|
46713
|
+
type: external_exports.literal("secp256k1"),
|
|
46714
|
+
address: external_exports.string(),
|
|
46715
|
+
path: external_exports.string()
|
|
46716
|
+
}),
|
|
46717
|
+
solana: external_exports.object({
|
|
46718
|
+
type: external_exports.literal("ed25519"),
|
|
46719
|
+
address: external_exports.string(),
|
|
46720
|
+
path: external_exports.string()
|
|
46721
|
+
}).optional()
|
|
46722
|
+
}),
|
|
46723
|
+
crypto: cryptoSchema
|
|
46724
|
+
});
|
|
46725
|
+
var encryptedKeysSchema = external_exports.object({
|
|
46726
|
+
keys: external_exports.object({
|
|
46727
|
+
evm: external_exports.string().regex(/^0x[0-9a-fA-F]{64}$/),
|
|
46728
|
+
solana: external_exports.string().optional()
|
|
46729
|
+
})
|
|
46730
|
+
});
|
|
46731
|
+
var encryptedEntropySchema = external_exports.object({ entropy: external_exports.string() });
|
|
46732
|
+
function encryptWithKey(key, plaintext) {
|
|
46733
|
+
if (key.byteLength !== KEY_LENGTH) {
|
|
46734
|
+
throw new Error(`Expected a ${KEY_LENGTH}-byte AES-256-GCM key.`);
|
|
46735
|
+
}
|
|
46736
|
+
const nonce = randomBytes4(12);
|
|
46737
|
+
const cipher = createCipheriv("aes-256-gcm", key, nonce, {
|
|
46738
|
+
authTagLength: AUTH_TAG_LENGTH
|
|
46739
|
+
});
|
|
46740
|
+
const ciphertext = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
46741
|
+
return { nonce, ciphertext, tag: cipher.getAuthTag() };
|
|
46742
|
+
}
|
|
46743
|
+
function decryptWithKey(key, sealed) {
|
|
46744
|
+
if (key.byteLength !== KEY_LENGTH) {
|
|
46745
|
+
throw new Error(`Expected a ${KEY_LENGTH}-byte AES-256-GCM key.`);
|
|
46746
|
+
}
|
|
46747
|
+
if (sealed.nonce.byteLength !== 12) {
|
|
46748
|
+
throw new Error("Expected a 12-byte AES-GCM nonce.");
|
|
46749
|
+
}
|
|
46750
|
+
if (sealed.tag.byteLength !== AUTH_TAG_LENGTH) {
|
|
46751
|
+
throw new Error(`Expected a ${AUTH_TAG_LENGTH}-byte AES-GCM authentication tag.`);
|
|
46752
|
+
}
|
|
46753
|
+
const decipher = createDecipheriv("aes-256-gcm", key, sealed.nonce, {
|
|
46754
|
+
authTagLength: AUTH_TAG_LENGTH
|
|
46755
|
+
});
|
|
46756
|
+
decipher.setAuthTag(sealed.tag);
|
|
46757
|
+
return Buffer.concat([decipher.update(sealed.ciphertext), decipher.final()]);
|
|
46758
|
+
}
|
|
46759
|
+
function validatePrivateKey(value) {
|
|
46760
|
+
const normalized = value.trim().toLowerCase();
|
|
46761
|
+
if (!/^0x[0-9a-f]{64}$/u.test(normalized)) {
|
|
46762
|
+
throw new KeystoreError(
|
|
46763
|
+
"A private key is 0x followed by 64 hexadecimal characters. Check for a missing character."
|
|
46764
|
+
);
|
|
46765
|
+
}
|
|
46766
|
+
return normalized;
|
|
46767
|
+
}
|
|
46768
|
+
|
|
46743
46769
|
// src/movement-open.ts
|
|
46744
46770
|
function isOpenMovementLeg(leg, journalEvidence) {
|
|
46745
46771
|
if (leg.status === "sent" || leg.status === "cancelled") return false;
|
|
@@ -47356,7 +47382,7 @@ async function withVaultLock(path, operation) {
|
|
|
47356
47382
|
try {
|
|
47357
47383
|
return await operation();
|
|
47358
47384
|
} finally {
|
|
47359
|
-
await handle.close();
|
|
47385
|
+
await handle.close().catch(() => void 0);
|
|
47360
47386
|
await unlink4(lockPath).catch(() => void 0);
|
|
47361
47387
|
}
|
|
47362
47388
|
}
|
|
@@ -47427,6 +47453,35 @@ var routerRefillSchema = external_exports.object({
|
|
|
47427
47453
|
belowUsd: external_exports.number().finite().min(0),
|
|
47428
47454
|
tierUsd: external_exports.union([external_exports.literal(1), external_exports.literal(5), external_exports.literal(20), external_exports.literal(50)])
|
|
47429
47455
|
});
|
|
47456
|
+
var routerPendingPurchaseSchema = external_exports.strictObject({
|
|
47457
|
+
receiptId: external_exports.string().min(1),
|
|
47458
|
+
status: external_exports.enum(["prepared", "signed", "settled", "unknown"]),
|
|
47459
|
+
createdAt: external_exports.iso.datetime(),
|
|
47460
|
+
tierUsd: external_exports.union([external_exports.literal(1), external_exports.literal(5), external_exports.literal(20), external_exports.literal(50)]),
|
|
47461
|
+
link: agentLinkSchema,
|
|
47462
|
+
baselinePurchasedUsd: external_exports.number().finite().nonnegative().optional(),
|
|
47463
|
+
network: external_exports.string().min(1).optional(),
|
|
47464
|
+
amountAtomic: external_exports.string().regex(/^\d+$/u).optional(),
|
|
47465
|
+
transaction: external_exports.string().optional(),
|
|
47466
|
+
authorization: external_exports.strictObject({
|
|
47467
|
+
token: external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/u),
|
|
47468
|
+
from: external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/u),
|
|
47469
|
+
nonce: external_exports.string().regex(/^0x[0-9a-fA-F]{64}$/u),
|
|
47470
|
+
validBefore: external_exports.string().regex(/^\d+$/u)
|
|
47471
|
+
}).optional()
|
|
47472
|
+
}).superRefine((pending, context) => {
|
|
47473
|
+
if (pending.status === "signed" && (pending.authorization === void 0 || pending.network === void 0)) {
|
|
47474
|
+
context.addIssue({
|
|
47475
|
+
code: "custom",
|
|
47476
|
+
message: "Signed purchases require public authorization evidence."
|
|
47477
|
+
});
|
|
47478
|
+
}
|
|
47479
|
+
});
|
|
47480
|
+
var routerPurchaseStateSchema = external_exports.strictObject({
|
|
47481
|
+
version: external_exports.literal(1),
|
|
47482
|
+
pending: routerPendingPurchaseSchema.optional(),
|
|
47483
|
+
completedReceiptId: external_exports.string().optional()
|
|
47484
|
+
});
|
|
47430
47485
|
var ceilingSweepPendingSchema = external_exports.strictObject({
|
|
47431
47486
|
owner: external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/),
|
|
47432
47487
|
target: external_exports.string().regex(/^0x[0-9a-fA-F]{40}$/).optional(),
|
|
@@ -47445,6 +47500,7 @@ var walletEntrySchema = external_exports.object({
|
|
|
47445
47500
|
ceilingSweepAttemptedAt: external_exports.iso.datetime().optional(),
|
|
47446
47501
|
ceilingSweepPending: ceilingSweepPendingSchema.optional(),
|
|
47447
47502
|
routerRefill: routerRefillSchema.optional(),
|
|
47503
|
+
routerPendingPurchase: routerPendingPurchaseSchema.optional(),
|
|
47448
47504
|
link: agentLinkSchema.optional()
|
|
47449
47505
|
});
|
|
47450
47506
|
var walletRegistrySchema = external_exports.object({
|
|
@@ -48651,7 +48707,7 @@ async function exportBackupSourceAttempt(options, networks) {
|
|
|
48651
48707
|
registry: {
|
|
48652
48708
|
...snapshot.default !== void 0 && names.has(snapshot.default) ? { default: snapshot.default } : {},
|
|
48653
48709
|
accounts: accounts.map((account) => {
|
|
48654
|
-
const entry = snapshot.wallets[account.name];
|
|
48710
|
+
const entry = Object.hasOwn(snapshot.wallets, account.name) ? snapshot.wallets[account.name] : void 0;
|
|
48655
48711
|
const ceilingAtomic = entry?.ceilingAtomic === null ? null : entry?.ceilingAtomic ?? DEFAULT_CEILING_ATOMIC.toString();
|
|
48656
48712
|
return {
|
|
48657
48713
|
name: account.name,
|