@haven_ai/signer 0.9.0-alpha.0 → 0.10.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/dist/cli.cjs +6 -3
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +7 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +6 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -547,7 +547,7 @@ declare const SIGNER_HOSTED_HANDOFF_SHAPES: {
|
|
|
547
547
|
* `server.ts` re-exports them, so the package's public API is unchanged.
|
|
548
548
|
*/
|
|
549
549
|
declare const SIGNER_NAME = "@haven_ai/signer";
|
|
550
|
-
declare const SIGNER_VERSION = "0.
|
|
550
|
+
declare const SIGNER_VERSION = "0.10.0-alpha.0";
|
|
551
551
|
/**
|
|
552
552
|
* #3419: the marker the tool layer prefixes the undeclared-argument refusal
|
|
553
553
|
* with. The strict re-parse lives in THIS module (`parseStrictFor`, below) —
|
|
@@ -645,9 +645,9 @@ declare const toolSchemas: {
|
|
|
645
645
|
signer: string;
|
|
646
646
|
}>;
|
|
647
647
|
}, "strip", z$1.ZodTypeAny, {
|
|
648
|
+
network: string;
|
|
648
649
|
payment_id: string;
|
|
649
650
|
expires_at: string;
|
|
650
|
-
network: string;
|
|
651
651
|
payload_hash: string;
|
|
652
652
|
resource_url: string;
|
|
653
653
|
merchant_to: string;
|
|
@@ -663,9 +663,9 @@ declare const toolSchemas: {
|
|
|
663
663
|
payer_delegate?: string | undefined;
|
|
664
664
|
payer_agent_id?: string | undefined;
|
|
665
665
|
}, {
|
|
666
|
+
network: string;
|
|
666
667
|
payment_id: string;
|
|
667
668
|
expires_at: string;
|
|
668
|
-
network: string;
|
|
669
669
|
payload_hash: string;
|
|
670
670
|
resource_url: string;
|
|
671
671
|
merchant_to: string;
|
|
@@ -722,9 +722,9 @@ declare const toolSchemas: {
|
|
|
722
722
|
signer: string;
|
|
723
723
|
}>;
|
|
724
724
|
}, "strip", z$1.ZodTypeAny, {
|
|
725
|
+
network: string;
|
|
725
726
|
payment_id: string;
|
|
726
727
|
expires_at: string;
|
|
727
|
-
network: string;
|
|
728
728
|
payload_hash: string;
|
|
729
729
|
resource_url: string;
|
|
730
730
|
merchant_to: string;
|
|
@@ -740,9 +740,9 @@ declare const toolSchemas: {
|
|
|
740
740
|
payer_delegate?: string | undefined;
|
|
741
741
|
payer_agent_id?: string | undefined;
|
|
742
742
|
}, {
|
|
743
|
+
network: string;
|
|
743
744
|
payment_id: string;
|
|
744
745
|
expires_at: string;
|
|
745
|
-
network: string;
|
|
746
746
|
payload_hash: string;
|
|
747
747
|
resource_url: string;
|
|
748
748
|
merchant_to: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -547,7 +547,7 @@ declare const SIGNER_HOSTED_HANDOFF_SHAPES: {
|
|
|
547
547
|
* `server.ts` re-exports them, so the package's public API is unchanged.
|
|
548
548
|
*/
|
|
549
549
|
declare const SIGNER_NAME = "@haven_ai/signer";
|
|
550
|
-
declare const SIGNER_VERSION = "0.
|
|
550
|
+
declare const SIGNER_VERSION = "0.10.0-alpha.0";
|
|
551
551
|
/**
|
|
552
552
|
* #3419: the marker the tool layer prefixes the undeclared-argument refusal
|
|
553
553
|
* with. The strict re-parse lives in THIS module (`parseStrictFor`, below) —
|
|
@@ -645,9 +645,9 @@ declare const toolSchemas: {
|
|
|
645
645
|
signer: string;
|
|
646
646
|
}>;
|
|
647
647
|
}, "strip", z$1.ZodTypeAny, {
|
|
648
|
+
network: string;
|
|
648
649
|
payment_id: string;
|
|
649
650
|
expires_at: string;
|
|
650
|
-
network: string;
|
|
651
651
|
payload_hash: string;
|
|
652
652
|
resource_url: string;
|
|
653
653
|
merchant_to: string;
|
|
@@ -663,9 +663,9 @@ declare const toolSchemas: {
|
|
|
663
663
|
payer_delegate?: string | undefined;
|
|
664
664
|
payer_agent_id?: string | undefined;
|
|
665
665
|
}, {
|
|
666
|
+
network: string;
|
|
666
667
|
payment_id: string;
|
|
667
668
|
expires_at: string;
|
|
668
|
-
network: string;
|
|
669
669
|
payload_hash: string;
|
|
670
670
|
resource_url: string;
|
|
671
671
|
merchant_to: string;
|
|
@@ -722,9 +722,9 @@ declare const toolSchemas: {
|
|
|
722
722
|
signer: string;
|
|
723
723
|
}>;
|
|
724
724
|
}, "strip", z$1.ZodTypeAny, {
|
|
725
|
+
network: string;
|
|
725
726
|
payment_id: string;
|
|
726
727
|
expires_at: string;
|
|
727
|
-
network: string;
|
|
728
728
|
payload_hash: string;
|
|
729
729
|
resource_url: string;
|
|
730
730
|
merchant_to: string;
|
|
@@ -740,9 +740,9 @@ declare const toolSchemas: {
|
|
|
740
740
|
payer_delegate?: string | undefined;
|
|
741
741
|
payer_agent_id?: string | undefined;
|
|
742
742
|
}, {
|
|
743
|
+
network: string;
|
|
743
744
|
payment_id: string;
|
|
744
745
|
expires_at: string;
|
|
745
|
-
network: string;
|
|
746
746
|
payload_hash: string;
|
|
747
747
|
resource_url: string;
|
|
748
748
|
merchant_to: string;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { randomUUID, createHash } from 'crypto';
|
|
2
2
|
import { recoverTypedDataAddress, hashTypedData, hashMessage } from 'viem';
|
|
3
3
|
import { privateKeyToAccount } from 'viem/accounts';
|
|
4
|
-
import { createNextStepBuilder, addressFromKey, HavenSigningError, buildSweepTypedData, selectStandardPaymentOption, HavenApiError, toStandardPaymentRequirements, decodeBase64Json, encodeBase64Json, x402V2PaymentEnvelope, isSettlementChildTypedData, chainIdForNetwork, assertOwnSettlementChild, isPackedUserOperationTypedData, assertUserOpTypedDataBinding, assertBoundDirectPaymentUserOp, assertFundingLegPaysDelegate, HavenTypedDataRefusedError, buildSweepAuthorizationMessage, verifySignature, x402AuthorizationAmount, SignerRefusalCode, connectorUpgradeCommand, SIGNER_UPDATE_FALLBACK, HavenUnsupportedSignerVersionError, buildX402ExpectedMessage, TASK_SIGN_CONTEXT_VERSION, DIRECT_SIGN_CONTEXT_VERSION, AgentPaymentNextAction, HavenError, AgentPaymentFailureCode, havenClientIdentity, isSupportedNodeVersion, unsupportedNodeVersionMessage, x402RetryHeadersFor, HavenUserOpBindingError, connectorRerunCommand, assertOwnTaskChild, assertOwnTaskBudgetCloseUserOp, assertOwnSubBudgetChild, assertOwnSubBudgetCloseUserOp, readClientUpdate, HAVEN_CLIENT_HEADER } from '@haven_ai/sdk/edge';
|
|
4
|
+
import { createNextStepBuilder, addressFromKey, HavenSigningError, buildSweepTypedData, selectStandardPaymentOption, HavenApiError, toStandardPaymentRequirements, deriveX402PaymentNonce, decodeBase64Json, encodeBase64Json, x402V2PaymentEnvelope, isSettlementChildTypedData, chainIdForNetwork, assertOwnSettlementChild, isPackedUserOperationTypedData, assertUserOpTypedDataBinding, assertBoundDirectPaymentUserOp, assertFundingLegPaysDelegate, HavenTypedDataRefusedError, buildSweepAuthorizationMessage, verifySignature, x402AuthorizationAmount, SignerRefusalCode, connectorUpgradeCommand, SIGNER_UPDATE_FALLBACK, HavenUnsupportedSignerVersionError, buildX402ExpectedMessage, TASK_SIGN_CONTEXT_VERSION, DIRECT_SIGN_CONTEXT_VERSION, AgentPaymentNextAction, HavenError, AgentPaymentFailureCode, havenClientIdentity, isSupportedNodeVersion, unsupportedNodeVersionMessage, x402RetryHeadersFor, HavenUserOpBindingError, connectorRerunCommand, assertOwnTaskChild, assertOwnTaskBudgetCloseUserOp, assertOwnSubBudgetChild, assertOwnSubBudgetCloseUserOp, readClientUpdate, HAVEN_CLIENT_HEADER } from '@haven_ai/sdk/edge';
|
|
5
5
|
export { deriveDelegateAccountAddress } from '@haven_ai/sdk/edge';
|
|
6
6
|
import { stat, lstat, chmod, readFile, mkdir, rename, appendFile, writeFile } from 'fs/promises';
|
|
7
7
|
import { resolve, dirname, join } from 'path';
|
|
@@ -134,11 +134,14 @@ function createEdgeSigner(delegateKey, options = {}) {
|
|
|
134
134
|
const requirements = toStandardPaymentRequirements(paymentRequired, option);
|
|
135
135
|
const { exact } = await loadX402Schemes();
|
|
136
136
|
assertWindowOpenOrRetire();
|
|
137
|
-
const
|
|
138
|
-
account,
|
|
137
|
+
const unsigned = exact.evm.preparePaymentHeader(
|
|
138
|
+
account.address,
|
|
139
139
|
paymentRequired.x402Version,
|
|
140
140
|
requirements
|
|
141
141
|
);
|
|
142
|
+
unsigned.payload.authorization.nonce = deriveX402PaymentNonce(expected.paymentId);
|
|
143
|
+
const signed = await exact.evm.signPaymentHeader(account, requirements, unsigned);
|
|
144
|
+
const header = exact.evm.encodePayment(signed);
|
|
142
145
|
if (paymentRequired.x402Version < 2) {
|
|
143
146
|
x402Bindings.delete(x402Binding);
|
|
144
147
|
retireX402Binding(x402Binding, "header_built");
|
|
@@ -1422,7 +1425,7 @@ function encodeSiwxHeader(payload) {
|
|
|
1422
1425
|
|
|
1423
1426
|
// src/tools.ts
|
|
1424
1427
|
var SIGNER_NAME = "@haven_ai/signer";
|
|
1425
|
-
var SIGNER_VERSION = "0.
|
|
1428
|
+
var SIGNER_VERSION = "0.10.0-alpha.0";
|
|
1426
1429
|
var UNSUPPORTED_ARGUMENT_MARKER = "HavenSignerUnsupportedArgument:";
|
|
1427
1430
|
var USEROP_BINDING_MISMATCH = "USEROP_BINDING_MISMATCH";
|
|
1428
1431
|
var HavenUserOpBindingRefusedError = class extends HavenSigningError {
|