@aastar/sdk 0.25.0 → 0.26.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.
@@ -1,7 +1,7 @@
1
1
  import { selectorFromId, keccak256, solidityPacked, ERC4337Utils, BLSManager, resolveTier, algIdForTier, encodeAbiParams, ecdsa, ALG_CUMULATIVE_T3, ALG_CUMULATIVE_T2, ALG_P256, ALG_ECDSA, ALG_BLS, weierstrass, sha256 } from './chunk-X3AMH53O.js';
2
2
  import { buildInitConfig, needsValidatorRouter, airAccountActions, airAccountFactoryActions } from './chunk-6DZCDV4Q.js';
3
3
  import { CANONICAL_ADDRESSES, getCanonicalAddresses } from './chunk-MBWBHKUE.js';
4
- import { parseAbi, createPublicClient, http, getContract, formatEther, parseUnits, parseEther, encodeFunctionData, zeroAddress, concat, numberToHex, hexToBytes, formatUnits, encodeAbiParameters, keccak256 as keccak256$1, hashMessage as hashMessage$1, toRlp, concatHex, recoverAddress as recoverAddress$1 } from 'viem';
4
+ import { parseAbi, createPublicClient, http, getContract, formatEther, parseUnits, parseEther, encodeFunctionData, zeroAddress, concat, numberToHex, hexToBytes, formatUnits, encodeAbiParameters, keccak256 as keccak256$1, hashTypedData, encodePacked, hashMessage as hashMessage$1, toRlp, concatHex, recoverAddress as recoverAddress$1 } from 'viem';
5
5
  import axios from 'axios';
6
6
  import { createHash } from 'crypto';
7
7
  import { privateKeyToAccount } from 'viem/accounts';
@@ -4195,6 +4195,9 @@ function hexToBytes4(hex) {
4195
4195
  if (clean.length % 2 !== 0) {
4196
4196
  throw new Error("hexToBytes: odd-length hex string");
4197
4197
  }
4198
+ if (clean.length > 0 && !/^[0-9a-fA-F]+$/.test(clean)) {
4199
+ throw new Error("hexToBytes: non-hex characters in input");
4200
+ }
4198
4201
  const out = new Uint8Array(clean.length / 2);
4199
4202
  for (let i = 0; i < out.length; i++) {
4200
4203
  out[i] = parseInt(clean.slice(i * 2, i * 2 + 2), 16);
@@ -4229,11 +4232,14 @@ function buildClientDataJSON(challenge, origin = DEFAULT_ORIGIN) {
4229
4232
  return new TextEncoder().encode(json);
4230
4233
  }
4231
4234
  function buildAuthenticatorData(rpId = DEFAULT_RP_ID, signCount = 1) {
4235
+ if (!Number.isInteger(signCount) || signCount < 0 || signCount > 4294967295) {
4236
+ throw new Error(`buildAuthenticatorData: signCount must be a uint32 (0..2^32-1), got ${signCount}`);
4237
+ }
4232
4238
  const rpIdHash = createHash("sha256").update(rpId).digest();
4233
4239
  const out = new Uint8Array(37);
4234
4240
  out.set(rpIdHash, 0);
4235
4241
  out[32] = 5;
4236
- new DataView(out.buffer).setUint32(33, signCount >>> 0, false);
4242
+ new DataView(out.buffer).setUint32(33, signCount, false);
4237
4243
  return out;
4238
4244
  }
4239
4245
  async function buildAuthenticationCredential(opts) {
@@ -4261,6 +4267,9 @@ async function buildAuthenticationCredential(opts) {
4261
4267
  function commitChallenge(nonceBase64Url, payload) {
4262
4268
  const nonce = base64UrlDecode(nonceBase64Url);
4263
4269
  const payloadBytes = typeof payload === "string" ? hexToBytes4(payload) : payload;
4270
+ if (payloadBytes.length !== 32) {
4271
+ throw new Error(`commitChallenge: payload must be a 32-byte digest, got ${payloadBytes.length} bytes`);
4272
+ }
4264
4273
  const committed = createHash("sha256").update(nonce).update(payloadBytes).digest();
4265
4274
  return base64UrlEncode(new Uint8Array(committed));
4266
4275
  }
@@ -4278,10 +4287,19 @@ async function runWebAuthnCeremony(begin, options) {
4278
4287
  signer: options.signer,
4279
4288
  rpId: options.rpId,
4280
4289
  origin: options.origin,
4281
- signCount: options.signCount
4290
+ // The KMS enforces a strictly-increasing authenticator signCount (anti-clone). A
4291
+ // server-held signer (P256PasskeySigner) has no native counter, so default to a
4292
+ // monotonic value — else a second signature on the same key fails
4293
+ // "signCount not incremented". A real device passkey passes its own counter.
4294
+ signCount: options.signCount ?? nextSignCount()
4282
4295
  });
4283
4296
  return { ChallengeId: begun.ChallengeId, Credential: credential };
4284
4297
  }
4298
+ var _signCountCounter = Math.floor(Date.now() / 1e3);
4299
+ function nextSignCount() {
4300
+ _signCountCounter = _signCountCounter + 1 >>> 0;
4301
+ return _signCountCounter;
4302
+ }
4285
4303
  function beginAuthenticationChallenge(http2, keyId) {
4286
4304
  return http2.post("/BeginAuthentication", { KeyId: keyId });
4287
4305
  }
@@ -4304,6 +4322,133 @@ function runGrantSessionCeremony(http2, keyId, signer, options) {
4304
4322
  }
4305
4323
 
4306
4324
  // ../airaccount/src/server/services/kms-signer.ts
4325
+ function eip712Digest(params) {
4326
+ const types = Object.fromEntries(
4327
+ params.types.filter((t) => t.name !== "EIP712Domain").map((t) => [t.name, t.fields])
4328
+ );
4329
+ const message = Object.fromEntries(params.message.map((f) => [f.name, f.value]));
4330
+ return hashTypedData({
4331
+ domain: params.domain,
4332
+ types,
4333
+ primaryType: params.primaryType,
4334
+ message
4335
+ });
4336
+ }
4337
+ function u256(x) {
4338
+ if (typeof x === "number" && !Number.isSafeInteger(x)) {
4339
+ throw new Error(`u256: number ${x} exceeds safe-integer range \u2014 pass a bigint or string`);
4340
+ }
4341
+ return BigInt(x);
4342
+ }
4343
+ var MINT_TAGS = { agent: "AA-AGENT-MINT-v1", p256: "AA-P256-SESSION-MINT-v1" };
4344
+ function mintDigest(p) {
4345
+ const hex = p.walletId.replace(/-/g, "");
4346
+ if (hex.length !== 32 || !/^[0-9a-fA-F]+$/.test(hex)) {
4347
+ throw new Error("mintDigest: walletId must be a 16-byte UUID");
4348
+ }
4349
+ if (!Number.isInteger(p.index) || p.index < 0 || p.index > 4294967295) {
4350
+ throw new Error(`mintDigest: index must be a uint32, got ${p.index}`);
4351
+ }
4352
+ if (typeof p.ttlSecs === "number" && !Number.isInteger(p.ttlSecs)) {
4353
+ throw new Error(`mintDigest: ttlSecs must be an integer, got ${p.ttlSecs}`);
4354
+ }
4355
+ const ttlBig = BigInt(p.ttlSecs);
4356
+ if (ttlBig < -(1n << 63n) || ttlBig > (1n << 63n) - 1n) {
4357
+ throw new Error(`mintDigest: ttlSecs out of int64 range: ${ttlBig}`);
4358
+ }
4359
+ const sha2562 = (b) => new Uint8Array(createHash("sha256").update(b).digest());
4360
+ const utf8 = (s) => new TextEncoder().encode(s);
4361
+ const walletBytes = new Uint8Array(16);
4362
+ for (let i = 0; i < 16; i++) walletBytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
4363
+ const idx = new Uint8Array(4);
4364
+ new DataView(idx.buffer).setUint32(0, p.index, false);
4365
+ const ttl = new Uint8Array(8);
4366
+ new DataView(ttl.buffer).setBigInt64(0, ttlBig, false);
4367
+ const parts = [utf8(MINT_TAGS[p.kind]), walletBytes, idx, ttl, sha2562(utf8(p.subject))];
4368
+ const total = parts.reduce((n, a) => n + a.length, 0);
4369
+ const buf = new Uint8Array(total);
4370
+ let off = 0;
4371
+ for (const a of parts) {
4372
+ buf.set(a, off);
4373
+ off += a.length;
4374
+ }
4375
+ return "0x" + Buffer.from(sha2562(buf)).toString("hex");
4376
+ }
4377
+ function grantSessionFinalHash(p) {
4378
+ const callTargetsHash = keccak256$1(encodePacked(["address[]"], [p.callTargets]));
4379
+ const selectorsHash = keccak256$1(encodePacked(["bytes4[]"], [p.selectorAllowlist]));
4380
+ const isP256 = "keyX" in p;
4381
+ const inner = isP256 ? keccak256$1(
4382
+ encodeAbiParameters(
4383
+ [
4384
+ { type: "string" },
4385
+ { type: "uint256" },
4386
+ { type: "address" },
4387
+ { type: "address" },
4388
+ { type: "bytes32" },
4389
+ { type: "bytes32" },
4390
+ { type: "uint48" },
4391
+ { type: "address" },
4392
+ { type: "bytes4" },
4393
+ { type: "uint16" },
4394
+ { type: "uint32" },
4395
+ { type: "bytes32" },
4396
+ { type: "bytes32" },
4397
+ { type: "uint256" }
4398
+ ],
4399
+ [
4400
+ "GRANT_P256_SESSION_V2",
4401
+ u256(p.chainId),
4402
+ p.verifyingContract,
4403
+ p.account,
4404
+ p.keyX,
4405
+ p.keyY,
4406
+ p.expiry,
4407
+ p.contractScope,
4408
+ p.selectorScope,
4409
+ p.velocityLimit,
4410
+ p.velocityWindow,
4411
+ callTargetsHash,
4412
+ selectorsHash,
4413
+ u256(p.nonce)
4414
+ ]
4415
+ )
4416
+ ) : keccak256$1(
4417
+ encodeAbiParameters(
4418
+ [
4419
+ { type: "string" },
4420
+ { type: "uint256" },
4421
+ { type: "address" },
4422
+ { type: "address" },
4423
+ { type: "address" },
4424
+ { type: "uint48" },
4425
+ { type: "address" },
4426
+ { type: "bytes4" },
4427
+ { type: "uint16" },
4428
+ { type: "uint32" },
4429
+ { type: "bytes32" },
4430
+ { type: "bytes32" },
4431
+ { type: "uint256" }
4432
+ ],
4433
+ [
4434
+ "GRANT_SESSION_V2",
4435
+ u256(p.chainId),
4436
+ p.verifyingContract,
4437
+ p.account,
4438
+ p.sessionKey,
4439
+ p.expiry,
4440
+ p.contractScope,
4441
+ p.selectorScope,
4442
+ p.velocityLimit,
4443
+ p.velocityWindow,
4444
+ callTargetsHash,
4445
+ selectorsHash,
4446
+ u256(p.nonce)
4447
+ ]
4448
+ )
4449
+ );
4450
+ return hashMessage$1({ raw: inner });
4451
+ }
4307
4452
  var KmsManager = class {
4308
4453
  client;
4309
4454
  logger;
@@ -4393,6 +4538,29 @@ var KmsManager = class {
4393
4538
  this.ensureEnabled();
4394
4539
  return this.amzPost("/ChangePasskey", "TrentService.ChangePasskey", params);
4395
4540
  }
4541
+ // ── Ceremony wrappers for non-signing passkey ops (strict-readiness #135 item 2) ──
4542
+ // These are NON-signing ops, so the challenge is the raw nonce (no payload commitment),
4543
+ // but they MUST go through the ceremony (clientDataJSON present) — strict mode hard-rejects
4544
+ // any assertion without clientDataJSON. Run the ceremony internally so callers never reach
4545
+ // for the deprecated legacy `Passkey` field.
4546
+ /** Schedule key deletion, running the WebAuthn ceremony internally (raw-nonce). */
4547
+ async deleteKeyWithCeremony(params, signer, options) {
4548
+ this.ensureEnabled();
4549
+ const WebAuthn = await this.runAuthenticationCeremony(params.KeyId, signer, options);
4550
+ return this.deleteKey({ ...params, WebAuthn });
4551
+ }
4552
+ /** Unfreeze a dormant key, running the WebAuthn ceremony internally (raw-nonce). */
4553
+ async unfreezeKeyWithCeremony(params, signer, options) {
4554
+ this.ensureEnabled();
4555
+ const WebAuthn = await this.runAuthenticationCeremony(params.KeyId, signer, options);
4556
+ return this.unfreezeKey({ ...params, WebAuthn });
4557
+ }
4558
+ /** Rotate the bound passkey, running the WebAuthn ceremony internally (raw-nonce). */
4559
+ async changePasskeyWithCeremony(params, signer, options) {
4560
+ this.ensureEnabled();
4561
+ const WebAuthn = await this.runAuthenticationCeremony(params.KeyId, signer, options);
4562
+ return this.changePasskey({ ...params, WebAuthn });
4563
+ }
4396
4564
  /**
4397
4565
  * Sign a message or an EIP-155 transaction (WebAuthn-gated).
4398
4566
  * Provide exactly one of `Message` (hex) or `Transaction`. For a raw 32-byte
@@ -4534,24 +4702,50 @@ var KmsManager = class {
4534
4702
  return this.deriveAddress({ ...params, WebAuthn });
4535
4703
  }
4536
4704
  /**
4537
- * Sign a message or EIP-155 transaction, running the challenge-binding ceremony
4538
- * internally. `params.KeyId` is required (it identifies the wallet to challenge).
4705
+ * Sign a message or EIP-155 transaction via `/Sign`, running the ceremony internally.
4706
+ * `params.KeyId` is required.
4707
+ *
4708
+ * ⚠️ STRICT MODE: unlike {@link signHashWithCeremony} / {@link signTypedDataWithCeremony},
4709
+ * this does NOT auto-bind a payload commitment, because the TA derives the signed digest
4710
+ * from `Message` / `Transaction` host-side (EIP-191 / RLP) and the SDK can't reproduce it
4711
+ * byte-exactly for every input. So it sends the RAW nonce by default — which the KMS will
4712
+ * REJECT once strict mode (#63) is on. For strict-safe signing either:
4713
+ * - pass `options.payload` = the exact digest the TA will sign (you computed it), or
4714
+ * - prefer {@link signHashWithCeremony} (commits to a known 32-byte hash).
4539
4715
  */
4540
4716
  async signWithCeremony(params, signer, options) {
4541
4717
  this.ensureEnabled();
4542
4718
  const WebAuthn = await this.runAuthenticationCeremony(params.KeyId, signer, options);
4543
4719
  return this.sign({ ...params, WebAuthn });
4544
4720
  }
4545
- /** Sign a 32-byte digest, running the challenge-binding ceremony internally. */
4721
+ /**
4722
+ * Sign a 32-byte digest, running the challenge-binding ceremony internally.
4723
+ * Binds the challenge to `hash` (WYSIWYS commitment, #68) by default — pass an
4724
+ * explicit `options.payload` only to override.
4725
+ */
4546
4726
  async signHashWithCeremony(hash, target, signer, options) {
4547
4727
  this.ensureEnabled();
4548
- const assertion = await this.runAuthenticationCeremony(target.KeyId, signer, options);
4728
+ const assertion = await this.runAuthenticationCeremony(target.KeyId, signer, {
4729
+ ...options,
4730
+ payload: options?.payload ?? hash
4731
+ });
4549
4732
  return this.signHashWithWebAuthn(hash, assertion.ChallengeId, assertion.Credential, target);
4550
4733
  }
4551
- /** Sign EIP-712 typed data, running the challenge-binding ceremony internally. */
4734
+ /**
4735
+ * Sign EIP-712 typed data, running the challenge-binding ceremony internally.
4736
+ * Auto-binds the WYSIWYS commitment (#68): the ceremony challenge is
4737
+ * `SHA-256(nonce ‖ eip712Digest)`, where `eip712Digest` is the standard EIP-712
4738
+ * digest the KMS hashes host-side — computed here via {@link eip712Digest} so the
4739
+ * user's signature commits to the exact typed-data payload. Pass an explicit
4740
+ * `options.payload` only to override.
4741
+ */
4552
4742
  async signTypedDataWithCeremony(params, signer, options) {
4553
4743
  this.ensureEnabled();
4554
- const webAuthnAssertion = await this.runAuthenticationCeremony(params.keyId, signer, options);
4744
+ const payload = options?.payload ?? eip712Digest(params);
4745
+ const webAuthnAssertion = await this.runAuthenticationCeremony(params.keyId, signer, {
4746
+ ...options,
4747
+ payload
4748
+ });
4555
4749
  return this.signTypedDataWithWebAuthn({ ...params, webAuthnAssertion });
4556
4750
  }
4557
4751
  /**
@@ -4560,7 +4754,10 @@ var KmsManager = class {
4560
4754
  */
4561
4755
  async signGrantSessionWithCeremony(params, signer, options) {
4562
4756
  this.ensureEnabled();
4563
- const webAuthnAssertion = await this.runGrantSessionCeremony(params.keyId, signer, options);
4757
+ const webAuthnAssertion = await this.runGrantSessionCeremony(params.keyId, signer, {
4758
+ ...options,
4759
+ payload: options?.payload ?? grantSessionFinalHash(params)
4760
+ });
4564
4761
  return this.signGrantSession({ ...params, webAuthnAssertion });
4565
4762
  }
4566
4763
  /**
@@ -4569,7 +4766,10 @@ var KmsManager = class {
4569
4766
  */
4570
4767
  async signP256GrantSessionWithCeremony(params, signer, options) {
4571
4768
  this.ensureEnabled();
4572
- const webAuthnAssertion = await this.runGrantSessionCeremony(params.keyId, signer, options);
4769
+ const webAuthnAssertion = await this.runGrantSessionCeremony(params.keyId, signer, {
4770
+ ...options,
4771
+ payload: options?.payload ?? grantSessionFinalHash(params)
4772
+ });
4573
4773
  return this.signP256GrantSession({ ...params, webAuthnAssertion });
4574
4774
  }
4575
4775
  // ── WebAuthn Ceremonies ─────────────────────────────────────────
@@ -4626,7 +4826,7 @@ var KmsManager = class {
4626
4826
  * @param ceremonySigner authenticator that signs the WebAuthn challenge
4627
4827
  * (a browser passkey on the client, or {@link P256PasskeySigner} server-side).
4628
4828
  */
4629
- createKmsSignerWithCeremony(keyId, address, ceremonySigner, ceremonyOptions, commitPayload = false) {
4829
+ createKmsSignerWithCeremony(keyId, address, ceremonySigner, ceremonyOptions, commitPayload = true) {
4630
4830
  this.ensureEnabled();
4631
4831
  return new KmsSigner(keyId, address, this, {
4632
4832
  mode: "ceremony",
@@ -4754,7 +4954,15 @@ var KmsAgentService = class {
4754
4954
  // challenge bound to the HUMAN key. These helpers run the full ceremony
4755
4955
  // (begin → clientDataJSON → assertion) via the shared
4756
4956
  // {@link runAuthenticationCeremony} helper, then invoke the endpoint.
4757
- /** Mint an agent key, running the challenge-binding ceremony internally. */
4957
+ /**
4958
+ * Mint an agent key, running the challenge-binding ceremony internally.
4959
+ *
4960
+ * STRICT MODE (AirAccount #115): bind the mint params by passing `options.payload =
4961
+ * mintDigest({ kind: "agent", walletId, index, ttlSecs, subject })` — `index` is the
4962
+ * agent_index the KMS will assign (query it first), `subject` the JWT sub (human key id),
4963
+ * `ttlSecs` the JWT lifetime. Without a payload the ceremony sends the raw nonce, which
4964
+ * strict mode rejects.
4965
+ */
4758
4966
  async createAgentKeyWithCeremony(params, signer, options) {
4759
4967
  this.http.ensureEnabled();
4760
4968
  const webAuthnAssertion = await runAuthenticationCeremony(
@@ -4841,7 +5049,15 @@ var KmsSessionService = class {
4841
5049
  // Create + revoke gate on the generic purpose="authentication" challenge bound
4842
5050
  // to the HUMAN key. These helpers run the full ceremony (begin → clientDataJSON
4843
5051
  // → assertion) via the shared {@link runAuthenticationCeremony} helper.
4844
- /** Create a P-256 session key, running the challenge-binding ceremony internally. */
5052
+ /**
5053
+ * Create a P-256 session key, running the challenge-binding ceremony internally.
5054
+ *
5055
+ * STRICT MODE (AirAccount #115): bind the mint params by passing `options.payload =
5056
+ * mintDigest({ kind: "p256", walletId, index, ttlSecs, subject })` — `index` is the
5057
+ * session_index the KMS will assign (query it first), `subject` the JWT sub (human key
5058
+ * id), `ttlSecs` the JWT lifetime. Without a payload the ceremony sends the raw nonce,
5059
+ * which strict mode rejects.
5060
+ */
4845
5061
  async createP256SessionKeyWithCeremony(params, signer, options) {
4846
5062
  this.http.ensureEnabled();
4847
5063
  const webAuthnAssertion = await runAuthenticationCeremony(
@@ -4905,7 +5121,108 @@ var KmsPaymentSigner = class {
4905
5121
  this.http.ensureEnabled();
4906
5122
  return this.signWithAuth("/kms/SignX402Payment", { ...params }, auth);
4907
5123
  }
5124
+ // ── Ceremony-internal variants with WYSIWYS payload commitment (#68 / #135 item 1) ──
5125
+ // Each payment endpoint is a fixed-schema SignTypedData host-side, so the commitment
5126
+ // payload is the EIP-712 digest of that schema. We compute it SDK-side (digest helpers
5127
+ // below, schemas mirrored from kms/host/src/api_server.rs) and bind the ceremony
5128
+ // challenge to it: challenge = SHA-256(nonce ‖ eip712Digest). Live-verified against KMS.
5129
+ /** Sign a MicroPaymentChannel voucher, running the committed ceremony internally. */
5130
+ async signMicropaymentVoucherWithCeremony(params, signer, options) {
5131
+ this.http.ensureEnabled();
5132
+ const webAuthnAssertion = await runAuthenticationCeremony(this.http, params.keyId, signer, {
5133
+ ...options,
5134
+ payload: micropaymentVoucherDigest(params)
5135
+ });
5136
+ return this.signMicropaymentVoucher(params, { webAuthnAssertion });
5137
+ }
5138
+ /** Sign a GToken EIP-3009 authorization, running the committed ceremony internally. */
5139
+ async signGTokenAuthorizationWithCeremony(params, signer, options) {
5140
+ this.http.ensureEnabled();
5141
+ const webAuthnAssertion = await runAuthenticationCeremony(this.http, params.keyId, signer, {
5142
+ ...options,
5143
+ payload: gTokenAuthorizationDigest(params)
5144
+ });
5145
+ return this.signGTokenAuthorization(params, { webAuthnAssertion });
5146
+ }
5147
+ /** Sign an x402 payment, running the committed ceremony internally. */
5148
+ async signX402PaymentWithCeremony(params, signer, options) {
5149
+ this.http.ensureEnabled();
5150
+ const webAuthnAssertion = await runAuthenticationCeremony(this.http, params.keyId, signer, {
5151
+ ...options,
5152
+ payload: x402PaymentDigest(params)
5153
+ });
5154
+ return this.signX402Payment(params, { webAuthnAssertion });
5155
+ }
4908
5156
  };
5157
+ function micropaymentVoucherDigest(p) {
5158
+ return eip712Digest({
5159
+ domain: { name: "MicroPaymentChannel", version: "1.0.0", chainId: p.chainId, verifyingContract: p.verifyingContract },
5160
+ primaryType: "Voucher",
5161
+ types: [
5162
+ {
5163
+ name: "Voucher",
5164
+ fields: [
5165
+ { name: "channelId", type: "bytes32" },
5166
+ { name: "cumulativeAmount", type: "uint256" }
5167
+ ]
5168
+ }
5169
+ ],
5170
+ message: [
5171
+ { name: "channelId", value: p.channelId },
5172
+ { name: "cumulativeAmount", value: p.cumulativeAmount }
5173
+ ]
5174
+ });
5175
+ }
5176
+ function gTokenAuthorizationDigest(p) {
5177
+ return eip712Digest({
5178
+ domain: { name: "GToken", version: "1", chainId: p.chainId, verifyingContract: p.gTokenAddress },
5179
+ primaryType: "TransferWithAuthorization",
5180
+ types: [
5181
+ {
5182
+ name: "TransferWithAuthorization",
5183
+ fields: [
5184
+ { name: "from", type: "address" },
5185
+ { name: "to", type: "address" },
5186
+ { name: "value", type: "uint256" },
5187
+ { name: "validAfter", type: "uint256" },
5188
+ { name: "validBefore", type: "uint256" },
5189
+ { name: "nonce", type: "bytes32" }
5190
+ ]
5191
+ }
5192
+ ],
5193
+ message: [
5194
+ { name: "from", value: p.from },
5195
+ { name: "to", value: p.to },
5196
+ { name: "value", value: p.value },
5197
+ { name: "validAfter", value: p.validAfter },
5198
+ { name: "validBefore", value: p.validBefore },
5199
+ { name: "nonce", value: p.nonce }
5200
+ ]
5201
+ });
5202
+ }
5203
+ function x402PaymentDigest(p) {
5204
+ return eip712Digest({
5205
+ domain: { name: "SuperPaymaster", version: "1", chainId: p.chainId, verifyingContract: p.verifyingContract },
5206
+ primaryType: "PaymentPayload",
5207
+ types: [
5208
+ {
5209
+ name: "PaymentPayload",
5210
+ fields: [
5211
+ { name: "paymentId", type: "bytes32" },
5212
+ { name: "amount", type: "uint256" },
5213
+ { name: "recipient", type: "address" },
5214
+ { name: "deadline", type: "uint256" }
5215
+ ]
5216
+ }
5217
+ ],
5218
+ message: [
5219
+ { name: "paymentId", value: p.paymentId },
5220
+ { name: "amount", value: p.amount },
5221
+ { name: "recipient", value: p.recipient },
5222
+ { name: "deadline", value: p.deadline }
5223
+ ]
5224
+ });
5225
+ }
4909
5226
 
4910
5227
  // ../airaccount/src/server/services/kms-monitor-service.ts
4911
5228
  var KmsMonitorService = class {
@@ -5114,6 +5431,6 @@ var KmsSignerAdapter = class {
5114
5431
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
5115
5432
  */
5116
5433
 
5117
- export { ACCOUNT_ABI, AGENT_SESSION_KEY_VALIDATOR_ABI, AIRACCOUNT_ABI, AIRACCOUNT_ADDRESSES, AIRACCOUNT_FACTORY_ABI, AIR_ACCOUNT_COMPOSITE_VALIDATOR_ABI, AIR_ACCOUNT_DELEGATE_ABI, AIR_ACCOUNT_DELEGATE_ADDRESS, ALG_ID, AccountManager, AgentRegistryService, AirAccountServerClient, BLSSignatureService, CALLDATA_PARSER_REGISTRY_ABI, ConsoleLogger, DEFAULT_CREDENTIAL_ID, DEFAULT_KMS_ENDPOINT, DEFAULT_ORIGIN, DEFAULT_RP_ID, DvtPendingConfirmationError, EIP7702DelegateService, ENTRYPOINT_ABI_V6, ENTRYPOINT_ABI_V7_V8, ENTRYPOINT_ADDRESSES, ERC20_ABI, ERC8004Service, ERC8004_ADDRESSES, EXECUTE_BATCH_SELECTOR, EXECUTE_SELECTOR, EXECUTE_USER_OP_SELECTOR, EntryPointVersion, EthereumProvider, FACTORY_ABI_V6, FACTORY_ABI_V7_V8, FORCE_EXIT_MODULE_ABI, ForceExitService, GLOBAL_GUARD_ABI, GuardChecker, GuardStateReader, KmsAgentService, KmsHttpClient, KmsManager, KmsMonitorService, KmsPaymentSigner, KmsSessionService, KmsSigner, KmsSignerAdapter, L2_TYPE, LocalWalletSigner, MAX_GUARDIANS, MODULE_TYPE, MemoryStorage, ModuleManager, P256PasskeySigner, PaymasterManager, PaymasterPriceStalenessError, RECOVERY_THRESHOLD, RECOVERY_TIMELOCK_SECONDS, RecoveryService, SESSION_KEY_VALIDATOR_ABI, SessionKeyService, SilentLogger, TIER_GUARD_HOOK_ABI, TokenService, TransferManager, VALIDATOR_ABI, WEIGHT_CHANGE_EXPIRY_SECONDS, WEIGHT_CHANGE_THRESHOLD, WEIGHT_CHANGE_TIMELOCK_SECONDS, WalletManager, WeightedSignatureService, YAAAServerClient, base64UrlDecode, base64UrlEncode, beginAuthenticationChallenge, beginGrantSessionChallenge, buildAuthenticationCredential, buildAuthenticatorData, buildClientDataJSON, buildFullInitConfig, buildInstallModuleHash, buildUninstallModuleHash, commitChallenge, computeOapdSalt, erc8004AddressesForChain, getOapdAddress, getOapdAddressWithChainId, initConfigFromRecord, initConfigToTuple, isExecuteUserOpWrapped, isOapdDeployed, isPendingConfirmation, packP256SessionSignature, packSecp256k1SessionSignature, runAuthenticationCeremony, runGrantSessionCeremony, runWebAuthnCeremony, sepoliaV07Config, serializeGuardianSpecs, toGuardianSpecs, validateConfig, wrapExecuteUserOp };
5118
- //# sourceMappingURL=chunk-D2RDBN46.js.map
5119
- //# sourceMappingURL=chunk-D2RDBN46.js.map
5434
+ export { ACCOUNT_ABI, AGENT_SESSION_KEY_VALIDATOR_ABI, AIRACCOUNT_ABI, AIRACCOUNT_ADDRESSES, AIRACCOUNT_FACTORY_ABI, AIR_ACCOUNT_COMPOSITE_VALIDATOR_ABI, AIR_ACCOUNT_DELEGATE_ABI, AIR_ACCOUNT_DELEGATE_ADDRESS, ALG_ID, AccountManager, AgentRegistryService, AirAccountServerClient, BLSSignatureService, CALLDATA_PARSER_REGISTRY_ABI, ConsoleLogger, DEFAULT_CREDENTIAL_ID, DEFAULT_KMS_ENDPOINT, DEFAULT_ORIGIN, DEFAULT_RP_ID, DvtPendingConfirmationError, EIP7702DelegateService, ENTRYPOINT_ABI_V6, ENTRYPOINT_ABI_V7_V8, ENTRYPOINT_ADDRESSES, ERC20_ABI, ERC8004Service, ERC8004_ADDRESSES, EXECUTE_BATCH_SELECTOR, EXECUTE_SELECTOR, EXECUTE_USER_OP_SELECTOR, EntryPointVersion, EthereumProvider, FACTORY_ABI_V6, FACTORY_ABI_V7_V8, FORCE_EXIT_MODULE_ABI, ForceExitService, GLOBAL_GUARD_ABI, GuardChecker, GuardStateReader, KmsAgentService, KmsHttpClient, KmsManager, KmsMonitorService, KmsPaymentSigner, KmsSessionService, KmsSigner, KmsSignerAdapter, L2_TYPE, LocalWalletSigner, MAX_GUARDIANS, MODULE_TYPE, MemoryStorage, ModuleManager, P256PasskeySigner, PaymasterManager, PaymasterPriceStalenessError, RECOVERY_THRESHOLD, RECOVERY_TIMELOCK_SECONDS, RecoveryService, SESSION_KEY_VALIDATOR_ABI, SessionKeyService, SilentLogger, TIER_GUARD_HOOK_ABI, TokenService, TransferManager, VALIDATOR_ABI, WEIGHT_CHANGE_EXPIRY_SECONDS, WEIGHT_CHANGE_THRESHOLD, WEIGHT_CHANGE_TIMELOCK_SECONDS, WalletManager, WeightedSignatureService, YAAAServerClient, base64UrlDecode, base64UrlEncode, beginAuthenticationChallenge, beginGrantSessionChallenge, buildAuthenticationCredential, buildAuthenticatorData, buildClientDataJSON, buildFullInitConfig, buildInstallModuleHash, buildUninstallModuleHash, commitChallenge, computeOapdSalt, eip712Digest, erc8004AddressesForChain, gTokenAuthorizationDigest, getOapdAddress, getOapdAddressWithChainId, grantSessionFinalHash, initConfigFromRecord, initConfigToTuple, isExecuteUserOpWrapped, isOapdDeployed, isPendingConfirmation, micropaymentVoucherDigest, mintDigest, packP256SessionSignature, packSecp256k1SessionSignature, runAuthenticationCeremony, runGrantSessionCeremony, runWebAuthnCeremony, sepoliaV07Config, serializeGuardianSpecs, toGuardianSpecs, validateConfig, wrapExecuteUserOp, x402PaymentDigest };
5435
+ //# sourceMappingURL=chunk-4GJSK7E6.js.map
5436
+ //# sourceMappingURL=chunk-4GJSK7E6.js.map