@haven_ai/signer 0.8.0-alpha.0 → 0.9.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/index.d.cts CHANGED
@@ -9,9 +9,11 @@ import { z } from 'zod';
9
9
  * The edge signer core.
10
10
  *
11
11
  * Holds the delegate key in this process and exposes the signing operations a
12
- * hosted-MCP flow needs — five, none of them a raw-hash primitive (#3169): each
12
+ * hosted-MCP flow needs — six, none of them a raw-hash primitive (#3169): each
13
13
  * takes a payload something can check — a Haven binding verified here, typed
14
- * data the account validates on-chain, or a sweep authorization. It performs no network I/O and never
14
+ * data the account validates on-chain, a sweep authorization, or (since
15
+ * #3728) an EIP-4361 SIWX message composed in-package from grammar-validated
16
+ * challenge fields. It performs no network I/O and never
15
17
  * returns the key — only signatures and the standard x402 header. See
16
18
  * docs/architecture/07-edge-signer.md.
17
19
  */
@@ -51,6 +53,18 @@ interface EdgeSigner {
51
53
  * relayer broadcasts it and pays gas. Never broadcasts — pure signing.
52
54
  */
53
55
  signSweepAuthorization(input: SweepSignatureInput): Promise<SweepSignatureResult>;
56
+ /**
57
+ * Sign an EIP-4361 (SIWE) message with EIP-191 `personal_sign` (#3728) —
58
+ * the x402 Sign-In-With-X extension. The message ALWAYS reaches this method
59
+ * composed in-package by the tool layer (`siwx.ts`) from grammar-validated
60
+ * challenge fields, with the address taken from this key — never a
61
+ * caller-supplied string, hash or byte payload. The name is deliberately
62
+ * SIWX-scoped, not a generic `signMessage`: the delegate key's EIP-191
63
+ * surface on this interface stays single-purpose. Breaking for
64
+ * out-of-package `EdgeSigner` implementers (open question in #3728,
65
+ * decided: acceptable — the only implementation is `createEdgeSigner`).
66
+ */
67
+ signSiwxMessage(message: string): Promise<string>;
54
68
  }
55
69
  interface SweepSignatureInput {
56
70
  /** The authorization fields prepared by the backend. */
@@ -280,6 +294,12 @@ declare function signerCompatibility(): SignerCompatibility;
280
294
  declare function signerCapabilityAdvertisement(): {
281
295
  experimental: Record<string, SignerCompatibility>;
282
296
  };
297
+ interface SignerIdentity {
298
+ /** The credential file's `agent_id`, or `HAVEN_AGENT_ID`; absent when neither is set. */
299
+ agentId?: string;
300
+ /** The delegate key's address — always known, since the signer holds the key. */
301
+ delegateAddress?: string;
302
+ }
283
303
  /**
284
304
  * The agent-readable half: MCP `instructions`, which clients surface to the
285
305
  * model. The machine-readable capability above is the precise statement, but
@@ -289,8 +309,11 @@ declare function signerCapabilityAdvertisement(): {
289
309
  * It names the same fix as #1143 so an agent that hits either surface — the
290
310
  * handshake here or the signing-time error there — tells the user the same
291
311
  * thing.
312
+ *
313
+ * Since #3738 it also states the agent id and delegate address this signer is
314
+ * bound to, when `identity` is given.
292
315
  */
293
- declare function signerInstructions(): string;
316
+ declare function signerInstructions(identity?: SignerIdentity): string;
294
317
 
295
318
  /**
296
319
  * The edge signer's own credential requires *only* `delegate_key` — unlike
@@ -458,12 +481,26 @@ interface SigningAuditEntry {
458
481
  */
459
482
  safe_address?: string;
460
483
  chain_id?: number;
484
+ /**
485
+ * #3728, additive like `safe_address`/`chain_id`: present on SIWX entries
486
+ * only — the challenge domain and nonce the composed message committed to.
487
+ * The `payload_hash` already pins the exact composed message (its sha256,
488
+ * pre-signature), so an entry is replayable without these; they make a
489
+ * sign-in row scannable without re-deriving the message. No existing key
490
+ * renamed (#2914).
491
+ */
492
+ domain?: string;
493
+ nonce?: string;
461
494
  }
462
495
  interface SigningAuditContext {
463
496
  delegateAddress: string;
464
497
  accountAddress?: string;
465
498
  chainId?: number;
466
499
  auditPath?: string;
500
+ /** #3728, SIWX entries only: the challenge domain, emitted onto the row. */
501
+ domain?: string;
502
+ /** #3728, SIWX entries only: the challenge nonce, emitted onto the row. */
503
+ nonce?: string;
467
504
  }
468
505
  declare function defaultSigningAuditPath(credentialsPath?: string): string;
469
506
  declare function appendSigningAuditEntry(entry: SigningAuditEntry, path: string, options?: AppendAuditOptions): Promise<void>;
@@ -510,7 +547,7 @@ declare const SIGNER_HOSTED_HANDOFF_SHAPES: {
510
547
  * `server.ts` re-exports them, so the package's public API is unchanged.
511
548
  */
512
549
  declare const SIGNER_NAME = "@haven_ai/signer";
513
- declare const SIGNER_VERSION = "0.8.0-alpha.0";
550
+ declare const SIGNER_VERSION = "0.9.0-alpha.0";
514
551
  /**
515
552
  * #3419: the marker the tool layer prefixes the undeclared-argument refusal
516
553
  * with. The strict re-parse lives in THIS module (`parseStrictFor`, below) —
@@ -528,7 +565,7 @@ declare const UNSUPPORTED_ARGUMENT_MARKER = "HavenSignerUnsupportedArgument:";
528
565
  * and pair with the hosted server's construct/relay tools (#183). They sign;
529
566
  * they never call the Haven API and never emit the key.
530
567
  */
531
- type SignerToolName = 'haven_sign' | 'haven_x402_sign_header' | 'haven_sign_x402' | 'haven_sign_sweep_delegate';
568
+ type SignerToolName = 'haven_sign' | 'haven_sign_siwx' | 'haven_x402_sign_header' | 'haven_sign_x402' | 'haven_sign_sweep_delegate';
532
569
  declare const toolSchemas: {
533
570
  readonly haven_sign_sweep_delegate: {
534
571
  readonly authorization: z$1.ZodObject<{
@@ -725,6 +762,10 @@ declare const toolSchemas: {
725
762
  readonly typed_data: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
726
763
  readonly typed_data_b64: z$1.ZodOptional<z$1.ZodString>;
727
764
  };
765
+ readonly haven_sign_siwx: {
766
+ readonly url: z$1.ZodString;
767
+ readonly challenge: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
768
+ };
728
769
  };
729
770
  declare const toolDescriptions: Record<SignerToolName, string>;
730
771
  interface ToolSuccess<T> {
@@ -891,4 +932,4 @@ declare function assertSupportedNodeVersion(nodeVersion?: string): void;
891
932
  declare function runSignerStdioServer(options?: SignerOptions): Promise<void>;
892
933
  declare function runSignerConsentGate(signer: EdgeSigner, credentials: SignerCredentials | undefined, options: SignerOptions): Promise<SignerConsentDecision>;
893
934
 
894
- export { AUDIT_ROTATE_BYTES, type AppendAuditOptions, type EdgeSigner, OWNER_ONLY_MODE, type PermissionLog, type PermissiveFile, type ResolvedSignerRuntime, SIGNER_ACK_ENV, SIGNER_CAPABILITY_KEY, SIGNER_HOSTED_HANDOFF_SHAPES, SIGNER_NAME, SIGNER_VERSION, SUPPORTED_SWEEP_BINDING_VERSIONS, SUPPORTED_X402_EXPECTED_VERSIONS, type SignerCompatibility, type SignerConsentDecision, type SignerConsentInput, type SignerConsentOptions, type SignerCredentials, type SignerOptions, type SignerToolName, type SigningAuditContext, type SigningAuditEntry, type TightenOutcome, type ToolFailure, type ToolPayload, type ToolSuccess, UNSUPPORTED_ARGUMENT_MARKER, type X402ExpectedPayment, type X402FundingSignatureResult, type X402HeaderResult, appendSigningAuditEntry, assertSupportedBindingVersion, assertSupportedNodeVersion, assertX402MatchesExpected, buildSignerMcpServer, computeSignerConsentHash, createEdgeSigner, createSigningAuditEntry, createToolHandlers, defaultSigningAuditPath, ensureSignerConsent, hashPayloadForAudit, loadSignerCredentials, permissiveMode, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, tightenIfFilePermissive, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive, warnIfFilePermissive };
935
+ export { AUDIT_ROTATE_BYTES, type AppendAuditOptions, type EdgeSigner, OWNER_ONLY_MODE, type PermissionLog, type PermissiveFile, type ResolvedSignerRuntime, SIGNER_ACK_ENV, SIGNER_CAPABILITY_KEY, SIGNER_HOSTED_HANDOFF_SHAPES, SIGNER_NAME, SIGNER_VERSION, SUPPORTED_SWEEP_BINDING_VERSIONS, SUPPORTED_X402_EXPECTED_VERSIONS, type SignerCompatibility, type SignerConsentDecision, type SignerConsentInput, type SignerConsentOptions, type SignerCredentials, type SignerIdentity, type SignerOptions, type SignerToolName, type SigningAuditContext, type SigningAuditEntry, type TightenOutcome, type ToolFailure, type ToolPayload, type ToolSuccess, UNSUPPORTED_ARGUMENT_MARKER, type X402ExpectedPayment, type X402FundingSignatureResult, type X402HeaderResult, appendSigningAuditEntry, assertSupportedBindingVersion, assertSupportedNodeVersion, assertX402MatchesExpected, buildSignerMcpServer, computeSignerConsentHash, createEdgeSigner, createSigningAuditEntry, createToolHandlers, defaultSigningAuditPath, ensureSignerConsent, hashPayloadForAudit, loadSignerCredentials, permissiveMode, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, tightenIfFilePermissive, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive, warnIfFilePermissive };
package/dist/index.d.ts CHANGED
@@ -9,9 +9,11 @@ import { z } from 'zod';
9
9
  * The edge signer core.
10
10
  *
11
11
  * Holds the delegate key in this process and exposes the signing operations a
12
- * hosted-MCP flow needs — five, none of them a raw-hash primitive (#3169): each
12
+ * hosted-MCP flow needs — six, none of them a raw-hash primitive (#3169): each
13
13
  * takes a payload something can check — a Haven binding verified here, typed
14
- * data the account validates on-chain, or a sweep authorization. It performs no network I/O and never
14
+ * data the account validates on-chain, a sweep authorization, or (since
15
+ * #3728) an EIP-4361 SIWX message composed in-package from grammar-validated
16
+ * challenge fields. It performs no network I/O and never
15
17
  * returns the key — only signatures and the standard x402 header. See
16
18
  * docs/architecture/07-edge-signer.md.
17
19
  */
@@ -51,6 +53,18 @@ interface EdgeSigner {
51
53
  * relayer broadcasts it and pays gas. Never broadcasts — pure signing.
52
54
  */
53
55
  signSweepAuthorization(input: SweepSignatureInput): Promise<SweepSignatureResult>;
56
+ /**
57
+ * Sign an EIP-4361 (SIWE) message with EIP-191 `personal_sign` (#3728) —
58
+ * the x402 Sign-In-With-X extension. The message ALWAYS reaches this method
59
+ * composed in-package by the tool layer (`siwx.ts`) from grammar-validated
60
+ * challenge fields, with the address taken from this key — never a
61
+ * caller-supplied string, hash or byte payload. The name is deliberately
62
+ * SIWX-scoped, not a generic `signMessage`: the delegate key's EIP-191
63
+ * surface on this interface stays single-purpose. Breaking for
64
+ * out-of-package `EdgeSigner` implementers (open question in #3728,
65
+ * decided: acceptable — the only implementation is `createEdgeSigner`).
66
+ */
67
+ signSiwxMessage(message: string): Promise<string>;
54
68
  }
55
69
  interface SweepSignatureInput {
56
70
  /** The authorization fields prepared by the backend. */
@@ -280,6 +294,12 @@ declare function signerCompatibility(): SignerCompatibility;
280
294
  declare function signerCapabilityAdvertisement(): {
281
295
  experimental: Record<string, SignerCompatibility>;
282
296
  };
297
+ interface SignerIdentity {
298
+ /** The credential file's `agent_id`, or `HAVEN_AGENT_ID`; absent when neither is set. */
299
+ agentId?: string;
300
+ /** The delegate key's address — always known, since the signer holds the key. */
301
+ delegateAddress?: string;
302
+ }
283
303
  /**
284
304
  * The agent-readable half: MCP `instructions`, which clients surface to the
285
305
  * model. The machine-readable capability above is the precise statement, but
@@ -289,8 +309,11 @@ declare function signerCapabilityAdvertisement(): {
289
309
  * It names the same fix as #1143 so an agent that hits either surface — the
290
310
  * handshake here or the signing-time error there — tells the user the same
291
311
  * thing.
312
+ *
313
+ * Since #3738 it also states the agent id and delegate address this signer is
314
+ * bound to, when `identity` is given.
292
315
  */
293
- declare function signerInstructions(): string;
316
+ declare function signerInstructions(identity?: SignerIdentity): string;
294
317
 
295
318
  /**
296
319
  * The edge signer's own credential requires *only* `delegate_key` — unlike
@@ -458,12 +481,26 @@ interface SigningAuditEntry {
458
481
  */
459
482
  safe_address?: string;
460
483
  chain_id?: number;
484
+ /**
485
+ * #3728, additive like `safe_address`/`chain_id`: present on SIWX entries
486
+ * only — the challenge domain and nonce the composed message committed to.
487
+ * The `payload_hash` already pins the exact composed message (its sha256,
488
+ * pre-signature), so an entry is replayable without these; they make a
489
+ * sign-in row scannable without re-deriving the message. No existing key
490
+ * renamed (#2914).
491
+ */
492
+ domain?: string;
493
+ nonce?: string;
461
494
  }
462
495
  interface SigningAuditContext {
463
496
  delegateAddress: string;
464
497
  accountAddress?: string;
465
498
  chainId?: number;
466
499
  auditPath?: string;
500
+ /** #3728, SIWX entries only: the challenge domain, emitted onto the row. */
501
+ domain?: string;
502
+ /** #3728, SIWX entries only: the challenge nonce, emitted onto the row. */
503
+ nonce?: string;
467
504
  }
468
505
  declare function defaultSigningAuditPath(credentialsPath?: string): string;
469
506
  declare function appendSigningAuditEntry(entry: SigningAuditEntry, path: string, options?: AppendAuditOptions): Promise<void>;
@@ -510,7 +547,7 @@ declare const SIGNER_HOSTED_HANDOFF_SHAPES: {
510
547
  * `server.ts` re-exports them, so the package's public API is unchanged.
511
548
  */
512
549
  declare const SIGNER_NAME = "@haven_ai/signer";
513
- declare const SIGNER_VERSION = "0.8.0-alpha.0";
550
+ declare const SIGNER_VERSION = "0.9.0-alpha.0";
514
551
  /**
515
552
  * #3419: the marker the tool layer prefixes the undeclared-argument refusal
516
553
  * with. The strict re-parse lives in THIS module (`parseStrictFor`, below) —
@@ -528,7 +565,7 @@ declare const UNSUPPORTED_ARGUMENT_MARKER = "HavenSignerUnsupportedArgument:";
528
565
  * and pair with the hosted server's construct/relay tools (#183). They sign;
529
566
  * they never call the Haven API and never emit the key.
530
567
  */
531
- type SignerToolName = 'haven_sign' | 'haven_x402_sign_header' | 'haven_sign_x402' | 'haven_sign_sweep_delegate';
568
+ type SignerToolName = 'haven_sign' | 'haven_sign_siwx' | 'haven_x402_sign_header' | 'haven_sign_x402' | 'haven_sign_sweep_delegate';
532
569
  declare const toolSchemas: {
533
570
  readonly haven_sign_sweep_delegate: {
534
571
  readonly authorization: z$1.ZodObject<{
@@ -725,6 +762,10 @@ declare const toolSchemas: {
725
762
  readonly typed_data: z$1.ZodOptional<z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>>;
726
763
  readonly typed_data_b64: z$1.ZodOptional<z$1.ZodString>;
727
764
  };
765
+ readonly haven_sign_siwx: {
766
+ readonly url: z$1.ZodString;
767
+ readonly challenge: z$1.ZodRecord<z$1.ZodString, z$1.ZodUnknown>;
768
+ };
728
769
  };
729
770
  declare const toolDescriptions: Record<SignerToolName, string>;
730
771
  interface ToolSuccess<T> {
@@ -891,4 +932,4 @@ declare function assertSupportedNodeVersion(nodeVersion?: string): void;
891
932
  declare function runSignerStdioServer(options?: SignerOptions): Promise<void>;
892
933
  declare function runSignerConsentGate(signer: EdgeSigner, credentials: SignerCredentials | undefined, options: SignerOptions): Promise<SignerConsentDecision>;
893
934
 
894
- export { AUDIT_ROTATE_BYTES, type AppendAuditOptions, type EdgeSigner, OWNER_ONLY_MODE, type PermissionLog, type PermissiveFile, type ResolvedSignerRuntime, SIGNER_ACK_ENV, SIGNER_CAPABILITY_KEY, SIGNER_HOSTED_HANDOFF_SHAPES, SIGNER_NAME, SIGNER_VERSION, SUPPORTED_SWEEP_BINDING_VERSIONS, SUPPORTED_X402_EXPECTED_VERSIONS, type SignerCompatibility, type SignerConsentDecision, type SignerConsentInput, type SignerConsentOptions, type SignerCredentials, type SignerOptions, type SignerToolName, type SigningAuditContext, type SigningAuditEntry, type TightenOutcome, type ToolFailure, type ToolPayload, type ToolSuccess, UNSUPPORTED_ARGUMENT_MARKER, type X402ExpectedPayment, type X402FundingSignatureResult, type X402HeaderResult, appendSigningAuditEntry, assertSupportedBindingVersion, assertSupportedNodeVersion, assertX402MatchesExpected, buildSignerMcpServer, computeSignerConsentHash, createEdgeSigner, createSigningAuditEntry, createToolHandlers, defaultSigningAuditPath, ensureSignerConsent, hashPayloadForAudit, loadSignerCredentials, permissiveMode, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, tightenIfFilePermissive, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive, warnIfFilePermissive };
935
+ export { AUDIT_ROTATE_BYTES, type AppendAuditOptions, type EdgeSigner, OWNER_ONLY_MODE, type PermissionLog, type PermissiveFile, type ResolvedSignerRuntime, SIGNER_ACK_ENV, SIGNER_CAPABILITY_KEY, SIGNER_HOSTED_HANDOFF_SHAPES, SIGNER_NAME, SIGNER_VERSION, SUPPORTED_SWEEP_BINDING_VERSIONS, SUPPORTED_X402_EXPECTED_VERSIONS, type SignerCompatibility, type SignerConsentDecision, type SignerConsentInput, type SignerConsentOptions, type SignerCredentials, type SignerIdentity, type SignerOptions, type SignerToolName, type SigningAuditContext, type SigningAuditEntry, type TightenOutcome, type ToolFailure, type ToolPayload, type ToolSuccess, UNSUPPORTED_ARGUMENT_MARKER, type X402ExpectedPayment, type X402FundingSignatureResult, type X402HeaderResult, appendSigningAuditEntry, assertSupportedBindingVersion, assertSupportedNodeVersion, assertX402MatchesExpected, buildSignerMcpServer, computeSignerConsentHash, createEdgeSigner, createSigningAuditEntry, createToolHandlers, defaultSigningAuditPath, ensureSignerConsent, hashPayloadForAudit, loadSignerCredentials, permissiveMode, readAccountAddressEnv, readAccountAddressField, renderSignerConsentBlock, resolveEdgeSigner, resolveSignerRuntime, runSignerConsentGate, runSignerStdioServer, signerCapabilityAdvertisement, signerCompatibility, signerInstructions, tightenIfFilePermissive, toolDescriptions, toolSchemas, warnIfCredentialFilePermissive, warnIfFilePermissive };